On Mon, Jun 6, 2011 at 6:10 PM, Ron Michael wrote:
> Hello, I am into some calculation on a list object, therefore requesting the
> peers if there is any short cut way to so the same calculation.
>
> Let say I have following list object:
>
>> List <- vector('list', length = 3)
>> set.seed(1)
>> L
Hi Ron,
Seems like there might be a really elegant way, but I would use
lapply(). For instance:
lapply(seq_along(List), function(x) List[[x]] + Vector[x])
If you do this regularly and want something that reads more
intuitively, consider defining an operator that does this. %+% is
undefined (at
Hello, I am into some calculation on a list object, therefore requesting the
peers if there is any short cut way to so the same calculation.
Let say I have following list object:
> List <- vector('list', length = 3)
> set.seed(1)
> List[[1]] <- rnorm(5)
> List[[2]] <- rnorm(2)
> List[[3]] <- rno
3 matches
Mail list logo