freq(x, round.digits=2, style="simple", justify="right", plain.ascii=TRUE, file=NA, append=FALSE, escape.pipe=FALSE, weights=NA, rescale.weights=FALSE, ...)
2
.style='rmarkdown'
(see Details).NA
. To append output to an existing text file, use append=TRUE
.TRUE
) or to overwrite any existing file (FALSE
, default). If TRUE
and no file exists, a new file will be created.style='grid'
and file
argument is not NA
, in which case it will escape the pipe character (|) to allow Pandoc to correctly convert multiline cells.TRUE
, the function makes the sum of weights equal to the length of x, so that the total N remains unchanged. FALSE
by default.matrix
with attributes used by summarytool's print method.plain.ascii=TRUE
option is there to make results appear clean in the console, but creates problems when generating markdown documents. For this reason, whenever style='rmarkdown'
, the option is set to FALSE, unless plain.ascii=TRUE
is stated explicitly. On the other hand, with style='grid'
, if the intent is to produce markdown text, then the user needs to explicitly set plain.ascii=FALSE
.
data(tobacco)
freq(tobacco$gender)
freq(tobacco$gender, style="rmarkdown")
with(tobacco, by(smoker, gender, freq))
Run the code above in your browser using DataCamp Workspace