Displaying 1 result from an estimated 1 matches for "playfn".
2010 Nov 09
3
Row-wise recurive function call
...L, 11L, 24L, 39L, 7L, 47L), D = c(40L,
32L, 16L, 26L, 0L, 18L, 2L, 48L, 21L, 10L)), .Names = c("A",
"B", "C", "D"), class = "data.frame", row.names = c(NA, -10L))
I have a function that works off EVERY individual ROW to throw a result.
Like
playFn <- function (x){
+ result = ((x$A+6*x$B)/(3*x$C)+20)*x$D
+ return(result)
+ }
I want to apply the function for every row .... can I use an "apply"
function ... tried but not been able to ...
e.g. print(rapply(a,playFn))
Please advise.
Thanks,
S