[R] A question about "union"

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Fri Oct 17 13:45:35 CEST 2008


Leon Yee wrote:
> But the problem is that I have MANY vectors, whose names are of some
> specific pattern. It is not good for us to write a very long expression.
>
> vectors <- list(ls(pattern="xyz"))  didn't get what I want.

then you could mix the two approaches:

vectors = lapply(ls(pattern="xyz"), get)

u = NULL
for (v in vectors) ...

which version is better will of course depend on the particular context
of your problem.

vQ



More information about the R-help mailing list