RMark capture summaries

posts related to the RMark library, which may not be of general interest to users of 'classic' MARK

RMark capture summaries

Postby jlaufenb » Mon Apr 13, 2009 12:11 am

I am resampling my full dataset at various sampling effort scenarios to investigate how sample size affects bias and precision of Huggins closed population estimators for non-invasive hair captures of black bears (remember me JLaake? Ugh!). I need to aggregate the capture summaries for each of 100 replicates generated for each scenario. Having yet to master the ways of the R language, I can't figure out how to manipulate the "summary.ch" RMark function to get what I need. Below is the code I've started with. My replicate dataset files are named according to scenario (e.g., 10w50s = 10 weeks @ 50 samples/week analyzed) and replicate ID (e.g., 1 = replicate 1). Genius! The plan is to aggregate all 100 summaries for a given scenario into a single Excel file so I can get the capture info I need. In addition, I would like to append a column (i.e., "i") to each replicate's capture summary that identifies from which replicate it was derived prior to aggregation.

nreps=100

for( i in 1:nreps)
{

testdata =paste("Scenario10w50s",i,".txt",sep = "")
beardata =import.chdata(testdata,field.types=c("n","n","n"))
beardata.process =process.data(beardata,model="Huggins")
RepCaptureSummary =summary.ch(beardata.process,bygroup=FALSE,marray=FALSE)

}

Thanks
J Laufenberg
jlaufenb
 
Posts: 49
Joined: Tue Aug 05, 2008 2:12 pm
Location: Anchorage, AK

Postby jlaake » Mon Apr 13, 2009 1:46 pm

I worked with Jared off-list. summary.ch returns a list of dataframes and in his case the list had only one element. After referring the list element properly [[1]], he got what he wanted. Appendix C in Cooch and White has a tutorial on lists which may help understanding of lists with RMark.

Below is the R code he put together to do what he wanted:

RepCaptureSummary=NULL
nreps=100
for( i in 1:nreps)
{
testdata =paste("Scenario10w50s",i,".txt",sep = "")
beardata =import.chdata(testdata,field.types=c("n","n","n"))
beardata.process =process.data(beardata,model="Huggins")
IndivCaptureSummary =summary.ch(beardata.process,bygroup=FALSE,marray=FALSE)[[1]]
IndivCaptureSummary$Replicate =i
RepCaptureSummary =rbind(RepCaptureSummary,IndivCaptureSummary)
}
write.xls(RepCaptureSummary,"Scenario10w50s.Aggregated.Capture.Summaries.xls",colNames=TRUE,sheet=1,from=1,rowNames=TRUE)
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA


Return to RMark

Who is online

Users browsing this forum: No registered users and 1 guest

cron