On 10/10/11 04:53, R. Michael Weylandt wrote:

<SNIP>
Try this:

for (i in 1990:2009) {
     varName = paste("pci", i, collapse = "")
     assign(varName, log(get(varName))
}

<SNIP>

I believe that ``sep= " '' is needed here rather than collapse.

Try:
        paste("junk",42,collapse="")

You get

    [1] "junk 42"

with a space in it. Here paste is using the default value of sep, namely " ",
and is not using collapse at all, since there is nothing to collapse (the
value is a scalar to start with).

Whereas

        paste("junk",42,sep="")

gives

    [1] "junk42"

which is what is wanted.

    cheers,

        Rolf Turner

______________________________________________
R-help@r-project.org 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.

Reply via email to