I have a 2 column data.frame:
> d[1:5,]
a b
1 80015 C
2 80016 B
3 80023 C
4 80062 B
5 80069 B
I want to apply a function across each row:
> for(i in 1:nrow(d)) {
+ myFun(con, d[i,]$a, d[i,]$b)
+ }
How do I do this using apply()? I'm unsure how to tell apply() to pass
data from columns a and b for a given row as arguments to the function
myFun().
Thanks in advance for any pointers,
Nathan
--
--------------------------------------------------------
Dr. Nathan S. Watson-Haigh
OCE Post Doctoral Fellow
CSIRO Livestock Industries
University Drive
Townsville, QLD 4810
Australia
Tel: +61 (0)7 4753 8548
Fax: +61 (0)7 4753 8600
Web: http://www.csiro.au/people/Nathan.Watson-Haigh.html
______________________________________________
R-help@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.