[R] Automatically naming subsets in a for loop

denys denys at uoguelph.ca
Fri Jan 31 21:11:04 CET 2014


Hello,

I'm trying to subet my data based on long/lat. I have written a for loop
however I am not sure how to get R to name all my subsets different things.
Here is my code so far...

for(i in 0:31){
latl=38+(i*1)
latu=39+(i*1)
for(j in 0:33){
longl=(-72)+(j*1)
longu=(-71)+(j*1)
G$i$j<-subset(G, Lat>latl & Lat<latu & Long>longl & Long<longu)
}
}

However this just freezes my computer. 
Any help is appreciated!



--
View this message in context: http://r.789695.n4.nabble.com/Automatically-naming-subsets-in-a-for-loop-tp4684518.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list