Re: [R] aggregate function output

2013-11-01 Thread arun
You could also try: library(plyr)  newdf <- function(.data, ...) {    eval(substitute(data.frame(...)), .data, parent.frame())  } x1 <- ddply(mtcars,.(cyl,gear), newdf, mgp=t(quantile(mpg)),hp=t(quantile(hp))) #(found in one of the google group discussions) #or library(data.table) dt1 <- data.

Re: [R] aggregate function output

2013-11-01 Thread arun
Hi, Try: do.call(data.frame,c(x,check.names=FALSE)) A.K. Hello,   I´m using function aggregate in R 3.0.2.  If I run the instruction x<-aggregate(cbind(mpg,hp)~cyl+gear,data=mtcars,quantile) I get the result the following data.frame:   cyl gear mpg.0% mpg.25% mpg.50% mpg.75%

Re: [R] aggregate function output

2013-11-01 Thread Adams, Jean
Daniel, You can see better what is going on if you look at as.list(x) There you can see that cyl and gear are vectors but mpg and hp are matrices. You can rearrange them using the do.call() function x2 <- do.call(cbind, x) dim(x2) Jean On Fri, Nov 1, 2013 at 7:08 AM, Daniel Fernandes wrote:

[R] aggregate function output

2013-11-01 Thread Daniel Fernandes
Hello, I´m using function aggregate in R 3.0.2. If I run the instruction x<-aggregate(cbind(mpg,hp)~cyl+gear,data=mtcars,quantile) I get the result the following data.frame: cyl gear mpg.0% mpg.25% mpg.50% mpg.75% mpg.100% hp.0% hp.25% hp.50% hp.75% hp.100% 4 3 21.5 21.5