createDefMeasures {rrMisc} | R Documentation |
Create input table for descriptive table generated by descrTable. This input table defines the variables to report, the measures to apply and the precision of the results.
createDefMeasures(d.data, var.list)
d.data |
Data frame to report statistics from |
var.list |
A data frame for the mapping of the variable names to meaningful labels. The attribute 'var_name' for the variable names in d.data and 'var_label' for the labels. |
utility function for formating
data.frame as input for 'descrTable'
- measure_label: label text shown in resulting table (output from descrTable())
- measure_name: variable name
- measure_1: first statistics to be applied to date
- measure_2: second statistics to be applied to date
- measure_ref_level: for factors, specify the reference level
- measure_prec_1: precision - number of decimal places - for first statistics
- measure_prec_2: precision for second statistics
under continuous developement
Roland Rapold
none
other utility-functions in this R-package
if(require("car")) { # load sample data 'Mroz' from package 'car' data(Mroz) str(Mroz) # insert attribute 'i' for population size Mroz <- merge(data.frame(i=as.factor(1)), Mroz) str(Mroz) # reference list for variable labels var.list <- data.frame(var_name=c("i", "lfp", "k5", "k618", "wc", "lwg", "inc"), var_label=c("population", "employed", "# children to 5", "# children 6-18", "wife college", "log expected wage", "family income excl. wife")) # create definition-table without variable for groups Mroz_hc <- Mroz[ , -which(colnames(Mroz)=="hc")] # variation 1: default, no adjustments def.measures.1 <- createDefMeasures(d.data=Mroz_hc) print(def.measures.1) # variation 2: apply variable labels def.measures.2 <- createDefMeasures(d.data=Mroz_hc, var.list=var.list) def.measures.2[2, 6] <- -2 def.measures.2[9, 6] <- -1 print(def.measures.2) }