Re: [R] Create a list object in a loop

2012-03-09 Thread Aurelie Cosandey Godin
Thank you very much Michael! Best, Aurelie On 2012-03-09, at 11:56 AM, R. Michael Weylandt wrote: > You are overriding "b" at each loop iteration and consequently only > keeping the last one. > > Perhaps > > b <- list() > > for(i in sort(unique(OT1$month))){ > a<-OT1[OT1$month==i,] > b

Re: [R] Create a list object in a loop

2012-03-09 Thread Aurelie Cosandey Godin
Thank you Tal, useful link. Best, Aurelie On 2012-03-09, at 11:53 AM, Tal Galili wrote: > Hi Aurelie, > Please give this a look: > http://www.nealgroothuis.name/introduction-to-data-types-and-objects-in-r/ > > And see if this resolves most, or all, of your questions... > > > C

Re: [R] Create a list object in a loop

2012-03-09 Thread R. Michael Weylandt
You are overriding "b" at each loop iteration and consequently only keeping the last one. Perhaps b <- list() for(i in sort(unique(OT1$month))){ a<-OT1[OT1$month==i,] b[[i]]<-ppp(a$longitude,a$latitude,marks=a$fTSUM,window=newW) plot(b[[i]],main=i) } Generally it's bad practi

Re: [R] Create a list object in a loop

2012-03-09 Thread Tal Galili
Hi Aurelie, Please give this a look: http://www.nealgroothuis.name/introduction-to-data-types-and-objects-in-r/ And see if this resolves most, or all, of your questions... Contact Details:--- Contact me: tal.gal...@gmail.com |

[R] Create a list object in a loop

2012-03-09 Thread Aurelie Cosandey Godin
Dear all, I'm trying to create a list of point patterns ppp.object {spatstat} in a loop. My dataset looks like this: > names(OT1);head(OT1);dim(OT1) [1] "EID" "latitude" "longitude" "month" "year" "CPUE" "TSUM" [8] "fTSUM" EID latitud