tapply.stat {agricolae} | R Documentation |
Statistics of data grouped by factors
Description
This process lies in finding statistics which consist of more than one variable,
grouped or crossed by factors. The table must be organized by columns between
variables and factors.
Usage
tapply.stat(x, y, stat = "mean")
Arguments
x |
data.frame factors |
y |
data.frame variables |
stat |
Method |
Value
x |
Numeric |
y |
Numeric |
stat |
method = "mean", ... |
Author(s)
Felipe de Mendiburu
Examples
library(agricolae)
# case of 1 single factor
data(sweetpotato)
tapply.stat(sweetpotato[,1],sweetpotato[,2],mean)
attach(sweetpotato)
tapply.stat(virus,yield,sd)
tapply.stat(virus,yield,function(x) max(x)-min(x))
tapply.stat(virus,yield,function(x) quantile(x,0.75,6)-quantile(x,0.25,6))
# other case
data(cotton)
attach(cotton)
tapply.stat(cotton[,c(1,3,4)],yield,mean)
tapply.stat(cotton[,c(1,4)],yield,max)
# Height of pijuayo
data(growth)
attach(growth)
tapply.stat(growth[,2:1], height,function(x) mean(x,na.rm=TRUE))
# trees
data(trees)
attach(trees)
w<-tapply(trees[,3],trees[,2],function(x) mean(x,na.rm=TRUE))
#startgraph
barplot(w,density=c(4,8,12,16),col=c(2,4,6,8),angle=c(0,45,90,145),las=2)
#endgraph
tapply.stat(species,diameter,function(x) mean(x,na.rm=TRUE))
[Package
agricolae version 1.0-4
Index]