[R] the by function

Melissa2k9 m.mcquillan at lancaster.ac.uk
Thu Mar 26 16:06:38 CET 2009


Hey,

I have a dataframe with subjects who have watched films. The variables of
interest are Pixel number and Temperature on the face. For each subject
there are 8 films, for each film for each subject I need to measure the mean
number of pixels then merge this vector with the data frame. I have 

mean.pixels<-as.data.frame(by(Final[,5],Final[,1:2],mean)[1:13,])

where column 5 is the pixels variable and 1 and 2 are subject and film
number respectively. Now I can do this, but the average value of the pixel
is usually around 7000. For some reason the machine has only  calculated a
certain second of the film as having say 500 pixels. I need to use the by
function to calculate the mean pixels but I only want it to consider those
values of the pixel variable that are above 1000.

Does anyone know how I can modify the command I already have to make sure
this happens? Sorry it's a bit confusing but I find it hard to explain.
-- 
View this message in context: http://www.nabble.com/the-by-function-tp22723918p22723918.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list