Questions tagged [summarytools]

The "summarytools" tag is intended to be used in questions related to the R package of the same name.

summarytools is an R package focused on descriptive statistics. Its four core functions respectively produce:

  • Frequency tables
  • Cross-tabulations
  • Univariate numerical statitics
  • Dataframe summaries which combine elements of frequencies and numerical statistics, as well as graphical representations, missing data information, and variable labels

Its results can be displayed in the R console, but they can as easily be displayed in html documents formatted using Bootstrap CSS.

References:
Official CRAN page
Master branch on GitHub
Development branch on GitHub
Reference Manual (pdf)

R Vignettes:
Introduction to summarytools
Recommendations for Using summarytools With Rmarkdown

44 questions
1
vote
2 answers

dfSummary() graphs are not printed in the HTML file

When using dfSummary() from the "summarytools" package in Rmarkdown -file, I get Graph -part of the summary printed as plain ASCII despite the st_options(plain.ascii = FALSE). The correct graphs are printed in the /tmp -folder, but are not displayed…
brabont
  • 23
  • 4
1
vote
1 answer

R summarytools dfSummary not displaying correctly in RMarkdown tabs

I'm trying to put 2 dfSummary outputs into a tabbed section in RMarkdown. I think I have to use results = 'asis' in order for the plots to generate, but when I use that option the tab functionality breaks. Instead of appearing in tabs, the…
AlexP
  • 577
  • 1
  • 4
  • 15
1
vote
2 answers

Is there a way to add a scroll bar to dfSummary output in R markdown file?

I've already tried using the print function: print(dfSummary(df), method = "render") And also all the solutions here but they don't seem to work with html_document as the output file type of the R Markdown.
1
vote
1 answer

R markdown contingency table %>% tabulate column variables with selective values

I am quite new to R, coming from Stata. Below is the r markdown chunk with reproducible data example. The data is representative to the data i am working with. But only with more binary (logical) and factor variables in number. The libraries and…
Mahm00d27
  • 17
  • 7
1
vote
1 answer

export dfSummary into latex

I have a dataset consist of factors and numeric and I want to export view(dfSummary(mtcars)) in my latex is it possible? many thanks in advance library(summarytools) data("mtcars") view(dfSummary(mtcars)) this is not working…
Seyma Kalay
  • 2,037
  • 10
  • 22
1
vote
1 answer

dfSummary - formatting factor levels in html output in Rmarkdown?

I'm trying to put together an html rmd report and having an issue with how summarytools::dfSummary displays factor levels. When I print to browser or R-Studio viewer, levels are formatted so that they are stacked vertically: When I print to html in…
1
vote
1 answer

Odd differences between the base R summary() and summarytools descr() function results

I have a vector of numeric data (sample below). Let's store the vector as x. When I run summary(x) and descr(x), where descr() is from the summarytools package, I have agreement on the Min, Median, Mean, and Max values. However, my 1st & 3rd…
Shawn Janzen
  • 369
  • 3
  • 15
1
vote
4 answers

How to run a frequency table in R for a set of variables like you would say FREQUENCIES var1 TO var10 in SPSS?

I'm trying to run a set of frequency tables in R without having to write the code for every single variable. For example, using the mtcars data in SPSS I would so something like: FREQUENCIES mpg TO vs And it would give me the 8 frequency tables…
Carley
  • 63
  • 6
1
vote
1 answer

error when using dfSummary in summarytools

I am using summarytools in rmarkdown and I followed the instructions to print a summary statistics table, but it would not work: dfSummary(tobacco, plain.ascii = FALSE, style = "grid", graph.magnif = 0.75, valid.col = FALSE, tmp.img.dir =…
halo09876
  • 2,725
  • 12
  • 51
  • 71
1
vote
1 answer

Variable names disappear when using summarytools::descr() with by() in Shiny app

The descr() function from R-package summarytools generates common central tendency statistics and measures of dispersion for numerical data in R. When I use descr() with by() in a Shiny app, names of variable (features) contained in the data…
Payam Delfani
  • 45
  • 1
  • 7
0
votes
2 answers

Custom Stats / Values output from dfSummary in R

I'm new to R and am trying to create custom values in the 'Stats / Values' column in R. I use the dfSummary function as follows: dfSummary(as.data.frame(y), headings = FALSE, varnumbers = FALSE, labels.col = TRUE, max.distinct.values =…
mr_js
  • 949
  • 12
  • 29
0
votes
0 answers

dfsummary() from summarytools package has random backslashes in the values of freqs column

When using dfsummary() from the summarytools package on a factor vector, the values in freqs column have random backslashes at the start. Please see this output image. This is the code: x <- factor(c("Tertiary_pattern_3", "Tertiary_pattern_5",…
0
votes
1 answer

How to rename the labels that appear outside of the ctable output [summarytools]

I am trying to play around with the formatting of the labels in summarytools::ctable with no luck. I would like to keep the longer version of the question name on top of the table, and the shorter version of the question name inside the table (or…
NewBee
  • 990
  • 1
  • 7
  • 26
0
votes
0 answers

Adjust width of ctable/summarytool table

I am creating cross tables in rmarkdown using summarytools::ctable. The tables look good in rmarkdown, except that the first column that has a lot of text is messing up the format if the table output. I want to wrap the text of the first column so…
NewBee
  • 990
  • 1
  • 7
  • 26
0
votes
1 answer

summarytools error while knitting in R Markdown

I am knitting a code below in R Markdown (I work on ESS9 data: https://www.europeansocialsurvey.org/data/download.html?r=9) ess$social_trust<-rowSums(select(ess, ppltrst, pplfair, pplhlp), na.rm=TRUE) tapply(ess$social_trust, ess$gndr, dfSummary)…