Hi hi,
It is much easier to deal with lists than a large number of separate
objects. So the first answer to your question
> How can I apply a function to a list of variables.
.. might be to convert your "list of variables" to a regular list.
Instead of ...
monday <- 1:3
tuesday <- 4:7
wednesday
Hi:
Here's another way of doing this on the simplified version of your example:
L <- vector('list', 3) # initialize a list of three components
## populate it
for(i in seq_along(L)) L[[i]] <- rnorm(20, 10, 3)
## name the components
names(L) <- c('Monday', 'Tuesday', 'Wednesday')
## replace va
On 08.11.2011 17:59, Ana wrote:
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")
This is a list of length one character vectors rather than a "list of
variables".
func=function(x){x
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 m
4 matches
Mail list logo