rpdfsummarytools

How to put dfsummary dataframe in pdf using R?


when I write this in my chunk and I press the knit button

summary(bank)
data %>% group_by(data$y) %>% dfSummary() %>% view()

a window pops up with the 'dfsummary' data-frame outside of my pdf/html document. I want this data-frame to be in my pdf/html document. Can anyone help me please ?


Solution

  • Just remove %>% view():

    ```{r setup, results='asis'}
    library(magrittr)
    library(summarytools)
    library(dplyr)
    summary(mtcars)
    mtcars %>% group_by(mtcars$cyl) %>% dfSummary(, plain.ascii = FALSE, style = "grid", tmp.img.dir = "/tmp")
    

    Result:

    enter image description here