search for: rotatedata

Displaying 1 result from an estimated 1 matches for "rotatedata".

2010 Jan 29
1
apply function with grouped columns
...s either present or absent colFactor <- data.frame(ColTraits=factor(c(1, 1, 0, 0))) colFactor #Getting the means for the columns by row groups is easy MeanByRowTraits <- aggregate (myData, rowFactor[1], mean) MeanByRowTraits #But now to get the means for the rows by column groups is awkward rotateData <- data.frame(t(MeanByRowTraits[2:5])) colnames(rotateData) <- c(levels(rowFactor[,1])) rotateData #This is the kind of result I want in the end aggregate (rotateData, colFactor[1], mean) -- Jack Siegrist Graduate Program in Ecology & Evolution, and Department of Ecology, Evolution, &a...