Hi,
May be this helps:
dat1<- read.table(text="
group var1 var2 myvar
group1 1 a 100
group2 2 b 200
group2 34 c 300
group3 5 d 400
group3 6 e 500
group4 7 f 600
",sep="",header=TRUE,stringsAsFactors=FALSE)
library(plyr)
ddply(dat1,.(group),summarize, f_myvar=mifunc(myvar))
# group f_myvar
#1 group1 NA
#2 group2 299
#3 group2 300
#4 group3 499
#5 group3 500
#6 group4 NA
A.K.
______________________________________________
R-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.