mario icon indicating copy to clipboard operation
mario copied to clipboard

quality of life: display a single dataframe by itself without a pipe (also pairs well with ggplot)

Open pgbovine opened this issue 4 years ago • 2 comments

It would be nice to just display a dataframe by itself without doing %>% I(). i think the easiest thing to do is to have the 'code' be the name of the dataframe itself and the LHS be that dataframe, with a blank RHS. that way, my frontend will know just to render LHS dataframe and not an LHS -> RHS pair.

Another benefit of supporting solo dataframe views is that it will work well with ggplot. Currently with ggplot, it's annoying to have to do mpg %>% I() just to activate mario here:

library(dplyr)
library(ggplot2)

mpg %>% I() %>% ggplot(aes(displ, hwy, colour = class)) + 
  geom_point()

pgbovine avatar Dec 08 '21 05:12 pgbovine

also, i think assignments to ggplot don't work, like:

library(dplyr)
library(ggplot2)

my_plot <- mpg %>% I() %>% ggplot(aes(displ, hwy, colour = class)) + 
  geom_point()```

pgbovine avatar Dec 08 '21 22:12 pgbovine

  • [ ] single df
  • [ ] single gg obj
  • [ ] df %>% ggplot() + ...
  • [ ] df <- tibble(A = 1)
  • [ ] gg_obj <- df %>% ggplot() + ...
  • [ ] gg_obj2 <- gg_obj

seankross avatar Dec 08 '21 23:12 seankross