fp_msd_class2_msdmulti: fp_msd_class2_msdmulti function

fp_msd_class2_msdmultiR Documentation

fp_msd_class2_msdmulti function

Description

This function is a wrapper for fp_msd_class2 when there are multiple variables to analyze using functions outside of fp. Given a data frame and a vector of variable names this function will apply fp_msd_class2 to each one and rbind the results into a dataframe

Usage

fp_msd_class2_msdmulti(
  x,
  vars,
  col1names = NULL,
  varnames = c("Variables", "Function(s)"),
  classvar = NULL,
  funct1 = "mean",
  funct2 = "sd",
  shownval = TRUE,
  sepnval = TRUE,
  total = TRUE,
  smashfirstcols = FALSE,
  rnd_digs = 2
)

Arguments

x

dataframe containing the data to be summarized

vars

vector of variable names for the varaibles that are t be summarized. all variables must be numeric and present in the data frame

col1names

vector of names to change the rows in column 1 to. This is typically what you want the individual variables that the rows represent called in the table. this must be the same length as vars. default is NULL which simply returns vars.

varnames

vector of names to switch the first and second columns of the dataframe to. default is "Variables" and "Function(s)" respectively

classvar

optional class variable to cross with the independent variables. this is is typically presented as a slice (e.g. data$variable)

funct1

the first function to use (i.e. outside the parentheses) if fp='FALSE'. default is 'mean'. if supplying different functions be sure to quote e.g. "IQR"

funct2

the second function to use (i.e. inside the parentheses) if fp='FALSE'. default is 'sd'. if supplying different functions be sure to quote e.g. "IQR"

shownval

boolean indicating if the n value used after na removal should be displayed in non fp cases. default is TRUE

sepnval

boolean indicating if the n value created using shownval should appear as a separate column in numeric form. default is TRUE meaning it will show up as a separate column. NOTE: if 'smashfirstcols' is set to TRUE this argument will automatically be changed to FALSE

total

boolean indicating if a 'total' column should be added to the data frame. default is TRUE

smashfirstcols

boolean indicating if the first columns (i.e. 'Variables', 'Function(s)) should be combined into a single first column. Default is FALSE meaning they will not be combined. NOTE: if this is TRUE sepnval will be set to FALSE

rnd_digs

the number of digits to round results to. default is 2

Examples

fp_msd_class2_msdmulti_function()


clmacleod/highlandr documentation built on Oct. 11, 2023, 8:04 p.m.