Question about Appendix C.6 code

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

Question about Appendix C.6 code

Postby birdman » Tue Aug 27, 2013 3:04 pm

I have begun working through the information on RMark because I'd like to integrate some of my functional analysis with the R graphics capabilities, and I couldn't quite figure out how to get there simply using output from the MARK analysis.

I am currently following the code in section C.6 on design covariates in the most recent version of the chapter found on the site (08.02.2013). At the top of page C-29, we define a dataframe for effort, then merge it with the rest of the dipper data already in hand.


Code: Select all
df=data.frame(time=c(1980:1986),effort=c(10,5,2,8,1,2,3))
dipper.ddl=merge\_occasion.data(dipper.process,dipper.ddl,"p",df)



When I run the second line, I get the following:
"Error: unexpected input in "dipper.ddl=merge\"

Normally I can figure out the issue (a typo in my code) and resolve, but I've had no luck with this one. Can anyone put me back on the right track? Is this an error in the code provided, or possibly something wrong with my installation? Everything else has run fine, and I just updated to the latest versions (last week) of R and MARK. Any thoughts would be appreciated.
Shane
birdman
 
Posts: 34
Joined: Wed Oct 24, 2007 4:14 pm

Re: Question about Appendix C.6 code

Postby bacollier » Tue Aug 27, 2013 3:14 pm

Try taking the "\" out of the object name and see if it works.

\bret
bacollier
 
Posts: 231
Joined: Fri Nov 26, 2004 10:33 am
Location: Louisiana State University

Re: Question about Appendix C.6 code

Postby birdman » Tue Aug 27, 2013 3:38 pm

I meant to say that I did just that. I removed the "\", removed the "_", removed both and added a ".", and searched the forum for related documents. Thanks for the feedback, but sadly, it doesn't appear to fix the issue.
birdman
 
Posts: 34
Joined: Wed Oct 24, 2007 4:14 pm

Re: Question about Appendix C.6 code

Postby bacollier » Tue Aug 27, 2013 3:43 pm

birdman wrote:I meant to say that I did just that. I removed the "\", removed the "_", removed both and added a ".", and searched the forum for related documents. Thanks for the feedback, but sadly, it doesn't appear to fix the issue.


Sorry, I did not look close enough at this, I think that merge_occasion.data() might have been replaced with merge_design.covariates(), so try this:

Code: Select all
df=data.frame(time=c(1980:1986),effort=c(10,5,2,8,1,2,3))
dipper.ddl=merge_design.covariates(dipper.process,dipper.ddl,"p",df)


\bret
bacollier
 
Posts: 231
Joined: Fri Nov 26, 2004 10:33 am
Location: Louisiana State University

Re: Question about Appendix C.6 code

Postby bacollier » Tue Aug 27, 2013 3:45 pm

Correction, I think you will want bytime=TRUE in there as well

Code: Select all
df=data.frame(time=c(1980:1986),effort=c(10,5,2,8,1,2,3))
dipper.ddl=merge_design.covariates(dipper.process,dipper.ddl,"p",df, bytime=TRUE)


\bret[/quote]
bacollier
 
Posts: 231
Joined: Fri Nov 26, 2004 10:33 am
Location: Louisiana State University

Re: Question about Appendix C.6 code

Postby jlaake » Tue Aug 27, 2013 3:48 pm

merge.design.data was the original function and it was renamed to merge.occasion.data but this conflicted with S3 naming convention so it was changed to merge_design.covariates. type ?merge_design.covariates to see examples. I thought that this had been fixed in the recent version of the Appendix but possibly not. I'll look into it.
jlaake
 
Posts: 1480
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Question about Appendix C.6 code

Postby birdman » Tue Aug 27, 2013 4:17 pm

Thanks for looking into it. When I used your most recent suggestion:

Code: Select all
df=data.frame(time=c(1980:1986),effort=c(10,5,2,8,1,2,3))
dipper.ddl=merge_design.covariates(dipper.process,dipper.ddl,"p",df, bytime=TRUE)


I get a new error:

"Error in merge_design.covariates(dipper.process, dipper.ddl, "p", df, : unused argument (df)"

So... Looks like it fixed the original issue, but doesn't know what to do with df.

I also just saw Jeff's note and will look at ?merge_design.covariates tonight and see what I can learn.

Thanks again.
S
birdman
 
Posts: 34
Joined: Wed Oct 24, 2007 4:14 pm

Re: Question about Appendix C.6 code

Postby bacollier » Tue Aug 27, 2013 4:24 pm

I get a new error:

"Error in merge_design.covariates(dipper.process, dipper.ddl, "p", df, : unused argument (df)"

So... Looks like it fixed the original issue, but doesn't know what to do with df.

I also just saw Jeff's note and will look at ?merge_design.covariates tonight and see what I can learn.

Thanks again.
S


Sorry for all the spam everyone, I am typing to fast on my end and not paying attention: the "p" and dipper.process are not arguments to merge_design.covariates(), sorry. Assuming everything before this point is alright and you don't need bygroup, then it should be:

Code: Select all
dipper.ddl=merge_design.covariates(dipper.ddl,df, bytime=TRUE)
bacollier
 
Posts: 231
Joined: Fri Nov 26, 2004 10:33 am
Location: Louisiana State University

Re: Question about Appendix C.6 code

Postby jlaake » Tue Aug 27, 2013 4:34 pm

Below is the code including the process.data and make.design.data steps. Evan if you could swap out the last line in the Appendix for the last line in the first example below I'd appreciate it. I think I had you change this previously but had forgotten that the arguments changed as well. Sorry for the confusion. This is an example of the usefulness of LyX/LaTeX and Sweave/knitr to create these types of documents.

Code: Select all
df=data.frame(time=c(1980:1986),effort=c(10,5,2,8,1,2,3))
dipper.proc=process.data(dipper,begin.time=1980)
dipper.ddl=make.design.data(dipper.proc)
dipper.ddl$p=merge_design.covariates(dipper.ddl$p,df)



Another example using groups and uses default begin.time value is:
Code: Select all
dipper.proc=process.data(dipper,groups="sex")
dipper.ddl=make.design.data(dipper.proc)
df=data.frame(group=c(rep("Female",6),rep("Male",6)),time=rep(c(2:7),2),
  effort=c(10,5,2,8,1,2,3,20,10,4,16,2))
dipper.ddl$p=merge_design.covariates(dipper.ddl$p,df,bygroup=TRUE)
jlaake
 
Posts: 1480
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 0 guests