Learn R Programming

psytabs (version 1.0)

demographicTable: Demographic table.

Description

Produces a table of the distribution of demographic characteristics.

Usage

demographicTable(hor_fact, ver_fact, count = TRUE, percent = TRUE, header = TRUE)

Arguments

hor_fact
factor constituting the columns of the table.
ver_fact
factor constituting the rows of the table.
count
logical value that toggles whether to include the absolute values in the table.
percent
logical value that toggles whether to include the values in percent in the table.
header
logical value that toggles whether to include a header for the row factor.

Value

A dataframe constituting the demographic table.

Examples

Run this code
data(mydata)

tab.1 <- demographicTable(mydata$sex, mydata$age_group7)
tab.1
tab.2 <- demographicTable(mydata$sex, mydata$age_group7, count=FALSE)
tab.2
tab.3 <- demographicTable(mydata$sex, mydata$age_group7, percent=FALSE)
tab.3

#saveTable(tab.1, "demographicTable.rtf")

Run the code above in your browser using DataLab