sum_stats: Create a table of Summary Statistics

Description Usage Arguments

Description

Takes as input a data.frame and names of its columns which you wish to summarize. It will produce a data.frame with summary statistics. For continuous variables, the function returns mean, standard deviation, median, interquartile range. For catagorical variables, counts and percentages are returned. Count of missing values (coded as NAs) will be returned.

Usage

1
sum_stats(d, contin_vars, cat_vars, map = NULL, title)

Arguments

d

data.frame containing variables to be summarized

contin_vars

character vector containing names of continuous variables to be summarized. Code missing values as NA.

cat_vars

character vector containing names of catagorical variables to be summarized. These variables must be coded as factors. Code missing values as NA.

map

a named character vector containing the formatted rownames of the data.frame which this function produceces. The names of this vector should be the raw rownames of the table. It's best to run this function once with map=NULL. See what the raw rownames are, then construct the map vector to associate a clean rownames for each unformatted rowname.

title

a character vector of length 1. It will be the column name of the data.frame which this function will produce. The column name will contain the sample size count.


stablemarkets/sumstats documentation built on May 30, 2019, 8:43 a.m.