Pascal Boisson wrote:
<snip>
> I have variables C_1, C_2, C_3 ... that corresponds to vectors of size
> n, and I would like to cbind them.
>
> I get a vector of their names using : temp<- ls(pat="C")
>
> And I like to find a way to use this vector temp as an argument to
> cbind.
>
> Unfortunately, my various trials failed, here are some samples of what I
> tried :
<snip>
Try:
s0 <- ls(pat="^C") # Notice the ``^'' --- for safety.
m <- do.call("cbind",lapply(s0,"get")) # Names get lost.
colnames(m) <- s0 # So tack them on.
cheers,
Rolf Turner
[EMAIL PROTECTED]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.