[R] aggregate output to data frame

cir p c|rku@01 @end|ng |rom y@hoo@com
Wed Mar 27 21:40:07 CET 2019


Dear users,
i am trying to summarize data using "aggregate" with the following command:

aggregate(pcr$Ct,c(pcr["Gene"],pcr["Type"],pcr["Rep"]),FUN=function(x){c(mean(x), sd(x), sd(x)/sqrt(sd(x)))})

and the structure of the resulting data frame is 

'data.frame':    66 obs. of  4 variables:
$ Gene: Factor w/ 22 levels "14-3-3e","Act5C",..: 1 2 3 4 5 6 7 8 9 10 ...
$ Type: Factor w/ 2 levels "Std","Unkn": 2 2 2 2 2 2 2 2 2 2 ...
$ Rep : int  1 1 1 1 1 1 1 1 1 1 ...
 $ x   : num [1:66, 1:3] 16.3 16.7 18.2 17.1 18.6 ...

The actual data is "bundled" in a matrix $x of the data frame. I would like to have the columns of this matrix as individual numeric columns in the same data frame instead of a matrix, but cant really figure it out how to do this in an efficient way. Could someone help me with the construction of this?

Thanks a lot,

Cyrus



More information about the R-help mailing list