[R] lapply to list of variables

Ana rrasterr at gmail.com
Tue Nov 8 17:59:27 CET 2011


Hi

Can someone help me with this?

How can I apply a function to a list of variables.

something like this


listvar=list("Monday","Tuesday","Wednesday")
func=function(x){x[which(x<=10)]=NA}

lapply(listvar, func)

were
Monday=[213,56,345,33,34,678,444]
Tuesday=[213,56,345,33,34,678,444]
...

in my case I have a neverending list of vectors.

Thanks!



More information about the R-help mailing list