structure(list(A = c(22L, 26L, 3L, 24L, 20L, 34L, 48L, 3L, 20L,
17L), B = c(3L, 31L, 7L, 40L, 45L, 43L, 48L, 16L, 49L, 36L),
C = c(31L, 36L, 49L, 27L, 47L, 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