Thanks everyone. The mutate function worked great:
all2<- mutate(all1,upper=p75+1.5*(p75-p25),lower=p25-1.5*(p75-p25))
--
View this message in context:
http://r.789695.n4.nabble.com/Using-PLYR-to-apply-a-custom-function-to-a-data-frame-tp4663897p4663902.html
Sent from the R help mailing list
Hi,
You could try ?within()
set.seed(25)
ALL<- data.frame(q3=sample(15:30,10,replace=TRUE),
q1=sample(1:14,10,replace=TRUE))
res<-within(ALL,{lower<-q1- 1.5*(q3-q1);upper<-q3+1.5*(q3-q1)})
res
# q3 q1 upper lower
#1 21 5 45.0 -19.0
#2 26 6 56.0 -24.0
#3 17 14 21.5 9.5
#4 29 9 59.
2 matches
Mail list logo