Hi S-friends
I have a small, but to me tricky problem.
Let a denote a list, say
> a <- list()
> a$n1 <- 1:2
> a$n2 <- 3:4
> a
$n1:
[1] 1 2
$n2:
[1] 3 4
Let b denote a vector of same length as a, and assume that
>b <- c(0,12)
I know want to create the following merged list of a and b, consisting of a
[[i]] <- c(b[i],a[[i]])
> a
$n1:
[1] 0 1 2
$n2:
[1] 12 3 4
No problems in using a loop - but my list's are very long.
Any suggestions to avoid a loop will be appreciated
Kind regards
Sven
Adept Scientific Aps
|