class_by_dich | R Documentation |
base building function for the class_by_dich suite, recommend using class_by_dich_fp. given a suite of binary variables and a class variable creates a data frame with rows as class variable elements and columns as variables and columns
class_by_dich(
aggvars,
byvar,
funct = mean,
catname = "Class",
fieldnames = "none",
colns = FALSE,
pct = "none",
cnt = "none",
rnd_digs = 2
)
aggvars |
a data frame of variable names for those variables that you want aggregated. these must all be 0/1 binary variables. e.g. data[],c("var1","var2")] |
byvar |
a data frame of the class variable you want to use to split the data. the unique values of this variable will be the dataframe columns |
funct |
function to use for calculations. 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" |
colns |
boolean make the rows the same name as aggvars. default is FALSE |
pct |
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 |
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' |
rnd_digs |
the number of digits to which the results will be rounded |
class_by_dich_function()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.