MetricsBySplit.RdMetricsBySplit produces a data.frame describing one or several metric variables with various statistics SPLIT is a group VARNAME which may be left out. Tests may be preformed on Mean (t.test, oneway.test) or Median (wilcox.test,kruskal.test) MetricsBySplit is a wrapper function calling MetricBySplit for each COLUMN, rbinding the results.
MetricsBySplit(DFR, COLUMNS, SPLIT = NULL, LONGNAMES = NULL, PVALUE = F, TEST = NULL, ALL = T, SEL = NULL, DIGITS = 2, SHOW_N = F)
| DFR | is a dataframe |
|---|---|
| COLUMNS | colnames in DFR to be described (at least one) |
| SPLIT | =NULL split factor specified by a colname in DFR or as vector of fitting length. If NULL an ungrouped description is returned. |
| LONGNAMES | =NULL alternative names for the COLUMNS |
| PVALUE | =F If TRUE, tests on mean and Median are performed and added as last column |
| TEST | =NULL Choose TEST from c("Mean","Median") oce for all or for each COLUMN. If not specified set to both i.e. c("Mean","Median") |
| ALL | =T If TRUE, also overall statistics |
| SEL | =NULL if specified selects statistics from c("Nvalid", "Mean", "Sd", "Median", "Mad", "Perc25", "Perc75", "Min", "Max") [once for all columns] |
| DIGITS | =2 Number of digits for statistics |
| SHOW_N | =T Show N=length(METRIC) top left |
a data.frame OF CHARACTERS with statistics for each COLUMN by the group variableSPLIT
MetricsBySplit
if (FALSE) { DFR<-data.frame( Metric1=c(rnorm(57),rnorm(43,2,2)), Metric2=c(rnorm(57,1,2),rnorm(43,20,5)), Split=c(rep("Arm A",57),rep("Arm B",43)) ) MetricsBySplit(DFR,COLUMNS=c("Metric1","Metric2"),SPLIT="Split") MetricsBySplit(DFR,COLUMNS=c("Metric1","Metric2"),SPLIT=DFR$Split,ALL=F) MetricsBySplit(DFR,COLUMNS=c("Metric1","Metric2"),SEL=c("Mean","Sd")) }