[R] Applying a function

Rui Barradas ruipbarradas at sapo.pt
Sat Dec 24 00:25:34 CET 2011


Sorry, in the function body, NO 'tab1', use 'x' only:

recovery.rate <- function(x) unlist(lapply(split(x, x[,2]), function(x)
mean(x[[4]]=="y")))

The error is because 'tab1' existed in the environment and the function
would find it.

This time, tested after removing 'tab1'.

Rui Barradas



--
View this message in context: http://r.789695.n4.nabble.com/Applying-a-function-tp4229277p4230106.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list