visfactor | R Documentation |
This function shows you how the text labels and underlying numerical values of a given factor-type variable correspond. You can use this function in two ways: 1) in its default setting, the function returns a simple table (more accurately, a data.frame) where each row is a unique value of the factor variable. The table shows how numerical values and text labels correspond. 2) You can choose the 'detail' view, in which case the function prints out a table in which the rows are actual observations from your dataset and shows you how the factor variable's numerical values and text labels correspond in your dataset. You can choose how many rows of the dataset are printed, but the default is 15.
visfactor(variable, dataset, detail = NULL, nrows = NULL)
variable |
The variable from your dataset for which you want summary statistics. Specify it as a string (e.g., "gndr"). |
dataset |
Your dataset (a data.frame-type object). |
detail |
Do you want to get the 'detail' view (TRUE/FALSE)? |
nrows |
How many rows do you want to get printed out if you choose the detail-view (detail=TRUE). Must be a number. |
A data.frame.
## Not run:
# Loading dataset
data(ess, package = "bst290")
# Default view
visfactor(dataset = ess, variable = "gndr")
# Detailed view
visfactor(dataset = ess, variable = "gndr", detail = TRUE)
# Detailed view, with 25 instead of 15 rows printed
visfactor(dataset = ess, variable = "gndr", detail = TRUE, nrows = 25)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.