Page 1 of 1

warning Using formula(x) is deprecated when x is a character

PostPosted: Tue May 12, 2020 2:17 pm
by KerryK
hello, I'm returning to secr after a 5 year hiatus. I'm running into a problem when I try to run a secr models I get the following no matter how I phrase the models...

"Warning message:
Using formula(x) is deprecated when x is a character vector of length > 1.
Consider formula(paste(x, collapse = " ")) instead. "

I've been googling and going through the forum for the whole day, tried a variety of things then decided to run my old files and script from 2015 when secr worked just fine for me, got exactly the same message, so its not liking something. Has anyone had this message before, any suggestions?

My data is very basic camera trap data, not trying to do anything fancy at this stage

Files in the following format

1.Captures
# Session ID Occasion Detector
Site1 1 6 8
Site1 1 7 8
Site1 1 37 8
Site1 1 38 8
Site1 1 55 8

2. Traps (XY data is sensitive hence the xxxx!)

# Detector X Y Useage
1 xxxxxx xxxxx 0 0 0 1 1 1 1.....etc
2 xxxxxx xxxxxx 0 1 1 1 1 1 1.....etc


3. Habitat mask (suitable = 1, non -suitable = 0)

X Y Habitat
xxxxxx xxxxx 0
xxxxxx xxxxx 1 ....etc

4. Camera data

# Detector X Y
1 xxxxxx xxxxxx
2 xxxxxx xxxxxx ....

Data loads fine, read.capthist works fine, no obvious errors in the data. But running even the most basic secr.fit model results in the same error. Because my old files and script haven't worked in the newest version of secr I'm wondering if I'm just doing something fundamentally wrong with the way I am formatting my script for the newer version.

This is my script which worked fine on the last version of secr I used many years ago ;)

secrBASIC <- secr.fit(capthist, model=g0~1, mask=habitatmask, CL=TRUE, trace=FALSE)

Please help!

Thanks

Re: warning Using formula(x) is deprecated when x is a chara

PostPosted: Tue May 12, 2020 6:24 pm
by murray.efford
Hello
That's a new one on me. It would help to know which versions of R and secr you are using. Does this happen with builtin data, e.g. secr.fit(captdata)?
Murray

Re: warning Using formula(x) is deprecated when x is a chara

PostPosted: Tue May 12, 2020 8:19 pm
by murray.efford
I see that warning now I have updated R to 4.0.0. It is only a warning, and you can ignore it, as far as I can tell.
Murray

Re: warning Using formula(x) is deprecated when x is a chara

PostPosted: Wed May 13, 2020 9:14 am
by KerryK
Hi Murray

Many thanks for the swift reply, yes I'm running R 4.0.0 , I can see that if I run the built in data that it still runs secr.fit and gives you the output plus the warnings, but if I run it with my data, I just get the warning, no other useful output data, is there a way to ignore it do you think or should I just download an older version of R?

Thanks so much, Kerry

Re: warning Using formula(x) is deprecated when x is a chara

PostPosted: Wed May 13, 2020 9:15 am
by KerryK
I forgot to add I'm using secr 4.2.2....

Re: warning Using formula(x) is deprecated when x is a chara

PostPosted: Wed May 13, 2020 9:34 am
by KerryK
ok I went back to R ver 3.6. and it seems to be running ok so far....

Re: warning Using formula(x) is deprecated when x is a chara

PostPosted: Wed May 13, 2020 3:20 pm
by murray.efford
I'm glad you're able to keep working. As I read it, there must be some other problem with R 4.0. I'll run more checks today.
Murray

Re: warning Using formula(x) is deprecated when x is a chara

PostPosted: Thu May 14, 2020 3:11 pm
by murray.efford
I have tweaked the code for the pre-release version of secr (4.2.3) so that it no longer gives that warning with R 4.0.0. The pre-release version is available at https://www.otago.ac.nz/density/News.html (e.g., download the Windows binary and install from local zip file); it includes a couple of significant bug fixes.

I have not found other problems with R 4.0.0. I'd be glad of specifics if you find any. Picking up 'secr' after a break you may be caught by the changes in secr 4.0 - see secr-version4.pdf.

Murray

Re: warning Using formula(x) is deprecated when x is a chara

PostPosted: Fri May 15, 2020 6:43 am
by KerryK
Thanks so much Murray, I'll certainly let you know if any other warnings pop up in the new version of R. Thanks for the link to the changes as well.

Best

Kerry