Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xml experiment #35

Open
moodymudskipper opened this issue Jun 7, 2021 · 0 comments
Open

xml experiment #35

moodymudskipper opened this issue Jun 7, 2021 · 0 comments

Comments

@moodymudskipper
Copy link
Owner

moodymudskipper commented Jun 7, 2021

With a minor tweak implemented in https://github.com/moodymudskipper/boomer/tree/xml-experiment we can alter the output so it can be easily collapsed/expanded in an xml editor :

boom(subset(head(mtcars, 2), qsec > 17))
#> <subset CALL=subset(head(mtcars, 2), qsec GT 17)>
#> <head CALL=head(mtcars, 2)>
#>               mpg cyl disp  hp drat    wt  qsec vs am gear carb
#> Mazda RX4      21   6  160 110  3.9 2.620 16.46  0  1    4    4
#> Mazda RX4 Wag  21   6  160 110  3.9 2.875 17.02  0  1    4    4
#> </head>
#> <GT CALL=qsec GT 17>
#> [1] FALSE  TRUE
#> </GT>
#>               mpg cyl disp  hp drat    wt  qsec vs am gear carb
#> Mazda RX4 Wag  21   6  160 110  3.9 2.875 17.02  0  1    4    4
#> </subset>

my_print <- function(x) {
  writeLines(paste0("my: ", x))
  invisible(x)
}

boom(my_print(1 + 2))
#> <my_print CALL=my_print(1 + 2)>
#> <+ CALL=1 + 2>
#> [1] 3
#> </+>
#> my: 3
#> [1] 3
#> </my_print>

It comes with its problem too (readability, multiline, reserved characters), but the idea might be used for something nicer.

The above looks ok in notepad++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant