Adding groups/covariates in RMark

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

Adding groups/covariates in RMark

Postby abdnas » Sun Jan 08, 2023 12:20 pm

Apologies for the basic question, but how do you add groups/covariates in RMark? Here's my code:

Code: Select all
surv_dat <- read.csv("CJStestBDA.csv")
                  header = T, na.strings = c("", "N/A", "NA")
str(surv_dat)

write.table(surv_dat,file="BvrEncHistFINAL_ForCJS_20230107.inp", sep=" ",
            quote=F, col.names=F, row.names=F)

surv_age <- convert.inp("BvrEncHistFINAL_ForCJS_20230107.inp",
                        group.df=data.frame(Age=c("0", "1")),
                        covariates=data.frame(BDA=c("0", "1")))


I want Age to be a group and BDA to be a covariate. When I try to use convert.inp I get the error:

Code: Select all
"Error in convert.inp("BvrEncHistFINAL_ForCJS_20230107.inp", group.df = data.frame(Age = c("0",  :
 
Number of columns in data file does not match group/covariate specification
abdnas
 
Posts: 4
Joined: Sun Jan 08, 2023 12:23 am

Re: Adding groups/covariates in RMark

Postby cooch » Sun Jan 08, 2023 12:29 pm

abdnas wrote:Apologies for the basic question...


Which largely indicates you haven't read either Appendix C in the MARK book, or the workshop notes.
cooch
 
Posts: 1628
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Adding groups/covariates in RMark

Postby jlaake » Sun Jan 08, 2023 1:08 pm

Please read the documentation and help files. Have you read Appendix C in Cooch and White and/or the workshop
notes which are in the RMark documentation archive which is available via the link that is given when you type library*RMark) for the first time in a session.

The function convert.inp is for converting a file in MARK format to the RMark format. You can read the data in directly as you did with read.csv ( or other R functions)but you have to make sure that the capture history is a character variable. The function import.chdata was designed to read in a data file in RMark format and make sure character is a character variable but you do not need to use it.

Once you get the data file read in properly, you specify a group variable with the argument groups in process.data.
Any numeric variable in the data can be used as covariate. Group variable must be a factor variable. All of this is explained in the documentation.

Jeff
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Adding groups/covariates in RMark

Postby cooch » Sun Jan 08, 2023 9:35 pm

cooch wrote:
abdnas wrote:Apologies for the basic question...


Which largely indicates you haven't read either Appendix C in the MARK book, or the workshop notes.


Said workshop notes (and other very useful bits) are collated in a single .zip archive: http://www.phidot.org/software/mark/rma ... tation.zip

Said 'Appendix C' is found here: http://www.phidot.org/software/mark/doc ... /app_3.pdf
cooch
 
Posts: 1628
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Adding groups/covariates in RMark

Postby abdnas » Sun Jan 08, 2023 10:05 pm

Thank you both for the resources.
abdnas
 
Posts: 4
Joined: Sun Jan 08, 2023 12:23 am


Return to RMark

Who is online

Users browsing this forum: No registered users and 14 guests