class_by_dich_fp | R Documentation |
given a suite of binary variables and a class variable creates a data frame of frequencies and percents formatted as n(
class_by_dich_fp(
aggvars,
byvar,
data_to_use,
cntfunc = sum,
pctfunc = mean,
catname = "Class",
fieldnames = "none",
cols = TRUE,
pct_t = "pct",
cnt_t = "none",
transpose_result = TRUE,
varlist_name = "Variable",
total = TRUE,
digs = 2
)
aggvars |
a vector of variable names for those variables that you want aggregated. these must all be 0/1 binary variables |
byvar |
the class variable you want to use to split the data. the unique values of this variable will be the dataframe columns |
data_to_use |
the data frame than contains the aggvars and byvar |
cntfunc |
the function to use for the calculation outside of the parentheses. default is sum |
pctfunc |
the function to use inside the parentheses. default is mean |
catname |
the name given to the first column which contains the names of the variables supplied. default is 'Class' |
fieldnames |
vector of names to replace variable names supplied above in aggvars. if agvars = c("var1","var2","var3") and fiednames = c("do","ray","me") then the first variable in the returned dataset will be "do","ray","me" |
cols |
boolean make the rows the same name as aggvars. default is TRUE |
pct_t |
switch indicating if the results should be formatted as a percent. changing this variable to anything other than 'none' will activate the switch and rename the column to that value. default is 'none' |
cnt_t |
switch indicating if the results should be formatted as a percent. changing this variable to anything other than 'none' will activate the switch and rename the column to that value. default is 'none' |
transpose_result |
transposes the result so that rows are variables and columns are class variabe values. default is TRUE |
varlist_name |
the name given to the first column of the data frame which contains the list of variables in the aggvars binary suite. default is 'variable' |
total |
boolean indicating if a total column should be produced. default is TRUE |
digs |
the number of digits to which the results will be rounded |
class_by_dich_fp_function()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.