Description Usage Arguments Value Examples
This function generates frequency tables
1 2 3 4 5 6 7 8 |
x |
Input data. Can be a dataframe, list or vector. |
file |
File name. Optional file name to save the output. |
weight |
Weight variable name. (Note: this is a placeholder and not currently implemented) |
maxrow |
Maximum number of rows to display in each frequency table. |
type |
Output type. Either html or doc. |
template |
Word template. Optional doc template to use if producing doc output. |
A frequency table in html or doc format.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # Suppress external output for examples
options(frequency_render = FALSE)
# Create frequency tables for the entire dataset
freq(big5)
# For specific variable/s
freq(big5[5:6])
freq(big5$country)
# Produce a list of tables
out <- freq(big5[8:10])
out[1]
options(frequency_render = TRUE)
## Not run:
# To automatically open html output in your browser use the following option:
options(frequency_open_output = TRUE)
freq(big5[, c('gender', 'E1')])
# To save the output specify the filename and format
freq(big5, file = "mydir/myfile.html")
# Supports label attributes from the package foreign package
library(foreign)
dat <- read.spss(myfile)
freq(dat)
# (Note: foreign may drop attributes when using to.data.frame = TRUE)
df <- read.spss(myfile, to.data.frame = TRUE)
freq(df)
# Also supports label attributes from the haven package
library(haven)
dat <- read_sav(myfile)
freq(dat)
# as well as other data with no label attributes
dat <- data.frame(id = 1:3, val = letters[1:3])
freq(dat)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.