summarytools
summarytools copied to clipboard
report.nas does not work for freq() when using kable()
under freq() function report.nas = FALSE does not seem to work
Could you pls provide more details (small example and summarytools version)? Thx
Will re-open if and when more info is provided
I seem to have the same problem when printing the table.
freq(A$B, report.nas = FALSE, headings = FALSE) work just fine.
I have the same issue though when storing the result as an object and than printing it with kableExtra (I'm using rmarkdown).
` ####create table object table_object <- freq(A$B, report.nas = FALSE, headings = FALSE)
####direct print works oke table_object
####printing with cable doesn't give the expected result but includes <NA> row and % Valid and % Valid Cum. columns table_object %>% kable() %>% kable_paper(full_width = F) `
@jendrik20 @dcomtois
This happens because the freq
output actually does not change as a matrix object. report.nas = FALSE
is saved as an attribute which is later used by print.summarytools
. The suitable way to use in R Markdown documents seems to be print(table_object, method = "render")
.
However, I am not sure if it is possible to get a kable
output in order to be reformatted by kableExtra
functions like kable_paper
.
Please try using the tb()
function, which should allow you to manipulate the table adequately.