On 22/09/2009 4:50 PM, Rakknar wrote:
Hello. I'm trying to run a series of commands in two different datasets. For
make it efficient I want to make a loop for it. Until now the only command
for loops i found it's the for() command it's only for series of numbers and
not a series of strings,


What gave you that idea?  A for loop can loop over any vector.


witch it's what i'm needing. It would be something
like this

for(i in dataset1 dataset2) {

Use

for (i in c("dataset1", "dataset2"))

to set i to each of those strings in turn.

            i <- read.dta("dataset1.dta")
            ls()
            summary(i)
            str(i)
            attach(i)
            }

None of the above will work, but it's almost all a bad idea anyway.

Duncan Murdoch


I hope the idea it's clear. I'm using 2.9.1 Windows Version of R.

Thanks.

______________________________________________
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