[R] How can I make a list using aggregate function?

Jim Lemon jim at bitwrit.com.au
Fri Jun 29 13:50:32 CEST 2012


On 06/28/2012 06:58 PM, sureshraj wrote:
> Hi friends,
>
>     I need to generate a list, that should contain the quantile value of one
> column in a data frame. while I am compiling this one i am facing one bug,,
> Really I cannot find out that where the problem has occurred?  Could any one
> help me to come out from this bug??
>
> Here is the code,
> data<- lapply(comb.data$zFE, function(x) aggregate(x,
> by=list(comb.data[["sequence"]]), quantile, probs=c(0.5,0.8,0.9), na.rm=T))
>
> And I am facing bug like this,
> "Error in aggregate.data.frame(as.data.frame(x), ...) :
>    arguments must have same length"
>
Hi Suresh,
If your code is accurate, you have an element of the data frame 
comb.data named zFEl and you are asking for an element named zFE, which 
isn't there, and thus has length zero. Is your error simply one of 
misspelling?

Jim



More information about the R-help mailing list