Help with function convert.inp in RMark


#1

Hello guys,
I don't know if I am off topic here, but I really need some help with a very basic issue.

I am using the function "convert.inp" in the package "RMark" to perform some population estimations for my zoology thesis. The function works perfectly as follows:

Input_file = convert.inp("C:/Desktop/Data", group.df = data.frame(sex=c("YM","AM","F")), covariates = "age", use.comments = FALSE)

Now, I have to add another covariate after "age", as I have a new column in the data, and I cannot figure out how to change the script.

Could someone help me?


#2

Ideally you'd give us a reproducible example (reprex) of your issue as a starting point. A reprex makes it much easier for others to understand your issue and figure out how to help. A lack of a reprex just makes it much less likely others will reply.


Also, it looks like your code was not formatted correctly to make it easy to read for people trying to help you. Formatting code allows for people to more easily identify where issues may be occuring, and makes it easier to read, in general. I have edited you post to format the code properly.

In the future please put code that is inline (such as a function name, like mutate or filter) inside of backticks (`mutate`) and chunks of code can be put between sets of three backticks:

```
example <- foo %>%
  filter(a == 1)
```

This will help keep our community tidy and help you get the help you are looking for!

For more information, please take a look at the community's FAQ on formating code


#3

Hi! Welcome!

I have never used RMark myself, but judging from a quick scan of the documentation for convert.inp, it looks like the covariates argument accepts a vector of names, e.g., c("covariate1”, "covariate2", "covariate3"). For instance, the docs include this example:

bd=convert.inp(paste(pathtodata,"blckduck",sep="/"),
         covariates=c("age","weight","winglen","ci"),use.comments=TRUE)

c() is the basic way you combine values so they can be passed around together in R. If you’re feeling at all shaky in your R foundations, this thread has lots of great resources:


#4

your answer was perfect, solved my problem :smiley:

Thank you so much for this explanation

it makes everything clear to me.


#5

I will make sure to follow your guidelines in the future, thank you!