How to put dfsummary dataframe in pdf using R?

754 Views Asked by At

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 ?

1

There are 1 best solutions below

2
Sinval On BEST ANSWER

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