[R] Adapting R code for different traps

Jonathan Daily biomathjdaily at gmail.com
Thu Jun 9 16:49:00 CEST 2011


Hi Ben,

Unfortunately, I left the usb cable for my crystal ball at home, and
thus have no idea how your data is organized. Could you post an
example along with what you expect the output to be?

Jon

On Thu, Jun 9, 2011 at 7:22 AM, bjmjarrett <bjmjarrett at gmail.com> wrote:
> Hi all,
>
> My code:
>
>> temp<-outer(release.days,collection.days,'-')
>> temp<-ifelse(temp>=0,NA,temp)
>> release.diff<-apply(temp,2,max,na.rm=TRUE)
>
> works for one trap and does what I want. That is, it determines the time
> difference between the collection date of a trap and date of parasitoid
> release immediately before it, excluding releases that occurred on the same
> day as the collection.
>
> The code above, however, does not give the correct values - those that I
> have calculated for each trap individually. I am wondering how I can adapt
> this code for each trap ie. it uses only data associated with a particular
> trap ID.
>
> For instance:
>
>> temp<-outer(release.days[Trap],collection.days.2[Trap],'-')
>> temp<-ifelse(temp>=0,NA,temp)
>> release.diff.1<-apply(temp,2,max,na.rm=TRUE)
>
> calculates the same value for each trap, irrespective of collection day.
>
> Thanks in advance
>
> Ben
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Adapting-R-code-for-different-traps-tp3585215p3585215.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



-- 
===============================================
Jon Daily
Technician
===============================================
#!/usr/bin/env outside
# It's great, trust me.



More information about the R-help mailing list