Displaying 1 result from an estimated 1 matches for "meanlightfeed".
2009 Feb 03
3
lapply and aggregate function
...myD$meanLight <- unlist( lapply( myD$Light,
function(x) mean( myD$value[myD$Light == x]) ) )
# Mean for Feed
myD$meanFeed <- unlist( lapply( myD$Feed,
function(x) mean( myD$value[myD$Feed == x]) ) )
myD
# I would like to get a new Var "meanLightFeed"
# holding the "Group-Mean" for each combination (eg. A:a = 0.821581)
# by(myD$value, list(myD$Light, myD$Feed), mean)[[1]]
# Second
set.seed(321)
myD <- data.frame( Light = sample(LETTERS[1:2], 10, replace=T),
value=rnorm(20) )
w1 <- tapply(myD$value, m...