boomer icon indicating copy to clipboard operation
boomer copied to clipboard

Explore intermediate steps using View or a webpage ?

Open moodymudskipper opened this issue 3 years ago • 2 comments

Using View is a hack but would still be helpful,

We'd call boom(subset(head(mtcars, 1 + 1), qsec > 17), view = TRUE) and have this happen, simulated here by :

boomed <- list("subset(head(mtcars, 1 + 1), qsec > 17)" = list(
  " " = subset(head(mtcars, 1 + 1), qsec > 17),
  "head(mtcars, 1 + 1)" = list(
    " " = head(mtcars, 1 + 1),
    "1 + 1" = 1 + 1
  ),
  "qsec > 17" = c(FALSE, TRUE)
))

nm <- names(boomed)
assign(nm, boomed[[1]])
eval(substitute(View(OBJ), list(OBJ = as.symbol(nm))))

boomer_view

This is a bit akward, but technically we can have a nice webpage or shiny app that would do the same.

Instead (or on top) of printing, we'd store results in a nested list, and offer a nice interface to explore it.

I can imagine something with tabs as in {covr}, so if we rig_in_namespace several functions each call would get a tab, so we'd explore nesting by expanding the tree, and recursive rigged functions by clicking on calls that would open the relevant tab, intermediate results would be easy to print or fetch.

moodymudskipper avatar Jun 07 '21 13:06 moodymudskipper

see also https://github.com/moodymudskipper/boomer/issues/32

moodymudskipper avatar Jun 07 '21 19:06 moodymudskipper

Nested <details> maybe, with the first level open by default? Indent seems to be lost, but we could tweak with an extra <div> ?

Expression 1
Expression 2
Expression 3

krlmlr avatar Jun 11 '21 02:06 krlmlr