I use by() to generate a summary statistics like so: Lbys <- by(dat[Nidx], dat$LipTest, summary)
where Nidx is an index vector with names picking out the columns in the data frame dat. This returns a list of character arrays (see below for str() output) where the columns are named correctly but the rownames are empty strings and the values are strings prepended with the summary statistic's name (e.g. "Min.", "Median "). I am reading the code of summary.data.frame() but can't figure out how I can change the action of that function to return list of numeric matrices with as rownames the summary statistic's name ("Min.", "Max." etc) and as values the numeric values of the calculated summary statistic. Any help much appreciated! Regards, Alex van der Spek > str(Lbys) List of 2 $ : 'table' chr [1:6, 1:19] "Min. :-0.190 " "1st Qu.: 9.297 " "Median :10.373 " "Mean :10.100 " ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:6] "" "" "" "" ... .. ..$ : chr [1:19] "Cell_3_SOS....GVF." "Cell_3_SOSq..ms.ms." "Cell_3_Airflow..cfm." "Cell_3_Float..in.." ... $ T38: 'table' chr [1:6, 1:19] "Min. :8.648 " "1st Qu.:8.920 " "Median :9.018 " "Mean :9.027 " ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:6] "" "" "" "" ... .. ..$ : chr [1:19] "Cell_3_SOS....GVF." "Cell_3_SOSq..ms.ms." "Cell_3_Airflow..cfm." "Cell_3_Float..in.." ... - attr(*, "dim")= int 2 - attr(*, "dimnames")=List of 1 ..$ dat$LipTest: chr [1:2] "" "T38" - attr(*, "call")= language by.data.frame(data = dat[Nidx], INDICES = dat$LipTest, FUN = summary) - attr(*, "class")= chr "by" ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.