Displaying 1 result from an estimated 1 matches for "r49093".
2009 Sep 16
3
apply function across two variables by mult factors
...oop works, but not efficient for large datasets
testDF$value<-NA
for(i in levels(testDF$f1)){
for(j in levels(testDF$f2)){
testDF[testDF$f1==i & testDF$f2==j,]$value<-testFun(testDF[testDF
$f1==i & testDF$f2==j,1:2])
}
}
testDF
sessionInfo()
#R version 2.9.1 Patched (2009-08-07 r49093)
#i386-apple-darwin8.11.1
#
#locale:
#en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
#
#attached base packages:
#[1] stats graphics grDevices utils datasets methods base
Jon Loehrke
Graduate Research Assistant
Department of Fisheries Oceanography
School for Marine Science and Tec...