[R] Hmisc + summarize + quantile: Why only quantiles for first variable in data frame?

Kim Milferstedt milferst at uiuc.edu
Wed Apr 19 19:14:22 CEST 2006


I'm working on a data set that contains a couple of factors and a 
number of dependent variables. From all of these dependent variables 
I would like to calculate mean, standard deviation and quantiles. 
With the function FUN I get all the means and stdev that I want but 
quantiles are only calculated for the first of the dependent 
variables (column 8 in the summarize command). What do I have to do 
differently in order to get all the quantiles that I want?



sgldm2    <-  read.table("E:/analysistemp/060412_test_data2.txt", header=T)

FUN         <-  function(x)c(Mean=mean(x,na.rm=TRUE), 
STDEV=sd(x,na.rm=TRUE), Quantile=quantile(x, probs= 
ordering    <-  llist(time_h_f, Distance_f)

resALL      <-  summarize(sgldm2[,8:10], ordering, FUN)

More information about the R-help mailing list