Hi there,

I know this is probably a really simple question, but without the correct
keywords, or knowledge of the correct function it is hard to search for on
the net or within R.

How do I increment a dataframe (or similar) name within a loop and assign
data?

A simple example would be:

for(i in 1:10){
    test<-i
}

BUT I want it to be test[i]   ---   in other words I want my stored data to
be in this form:

test.1<-1
test.2<-2
test.3<-3... and so on.

I have tried doing things like:

test.i
test[i]
and have tried a paste command, for example

paste("test",i, sep="")

but this turns it into a factor and you cannot assign the data or anything.

Thanks in advance.

-- 
Gareth Campbell
PhD Candidate
The University of Auckland

P +649 815 3670
M +6421 256 3511
E [EMAIL PROTECTED]
[EMAIL PROTECTED]

        [[alternative HTML version deleted]]

______________________________________________
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