
Hi all,

I sent a request round last week asking for help with using a "for" loop to read and separate a large dataset. The response I got worked great, but now I have another problem with using my loop.

Basically I have a number of different files containing columned data. There are 132 datasets, named such that I have something in the form...

precip_colxxx.txt

...where xxx is a number ranging from 1 to 132. What I want to do is read in every 13th table and extract the third column, and then place this in a new dataset. The new dataset will thus compose of 11 columns of data. I have written the following bit of script to read in every 13th table separately, however I'm not sure how to do the next step of creating a new data frame and "dumping" the third column of my tables into this data frame. Is there are chance I will have to do a nested loop?

for (i in seq(1,120,13)) {

nm <- sprintf('precip_col%03d.txt', i)

precip <- read.table(nm, header=T)

}

Thanks very much in advance.

Andy

_________________________________________________________________

icons.

	[[alternative HTML version deleted]]


