Dear all,

I have a
big data frame:


str(data1)

'data.frame':   18272 obs. of  11 variables:

 $ tag  :
int  100001 100002 100003 100005 100007
100008 100009 100011 100012 100014 ...

 $ sp   :
Factor w/ 18 levels "acassp","acocar",..: 13 5 7 14 14 18 3
11 13 10 ...

 $ gx   :
num  20 10 35 68 88 63 123 115 137 136
...

 $ gy   :
num  30 25 24 1 10 40 45 25 23 45 ...

 $ d0   :
int  0 0 0 0 0 0 0 0 0 0 ...

 $ d1   :
int  395 395 395 395 395 395 395 395 395
395 ...

 $ d2   :
int  751 751 751 751 751 751 751 751 751
751 ...

 $ d3   :
int  1515 1515 1515 1515 1515 1515 1515
1515 1515 1515 ...

 $ d4   :
int  2562 2562 2562 2562 2562 2562 2562
2562 2562 2562 ...

 $ block: int 
1 1 1 1 1 1 1 1 1 1 ...

 $ treat: Factor w/ 4 levels
"I","M","N","T": 1 1 1 1 1 1 1 1 1 1
...


And I need to
do multiple selections of gx and gy for all the levels of: sp, block, treat, 
and when d0!="NA". Then
calculate some spatial functions with the selected gx and gy coordinates, and
save the results with a name according to the selection.
 

One single
selection could be done and named like that:

acocar1I=subset(data1,(treat=="I"
& data1$block==1 & data1$sp=="acocar" & data1$d0!="NA"))


These are some
of the functions I have to calculate:

acocar1I.spp<-spp(x=acocar1I$gx,
y=acocar1I$gy, window=wA)

acocar1I.dp<-dval(acocar1I.spp,25,2.5,18,20)


And I want
to create a 'results' object to access easily all the results:

acocar1I.res<-alist()

acocar1I.res$data1<-acocar1I

acocar1I.res$spp<-acocar1I.spp

acocar1I.res$dp<-acocar1I.dp


Can I do everything
in a single loop or a single function?

Many
thanks!











                                          
        [[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