Error: convert.units is deprecated

26 views
Skip to first unread message

Dominik Marchowski

unread,
Apr 7, 2023, 8:23:05 AM4/7/23
to distance-sampling
Dear folk,

I recently updated R and packages, also Distance. Probably the error lies in this, am I right? Could someone please tell me how to deal with this? Below is my code:


" library(Distance)

all15 <- read.table(choose.files(), header = T)

#Exploratory analysis

bins <- c(0, 50, 100, 200, 300)

#Model fitting and first summary

conversion.factor <- convert_units("meter", "kilometer", "square kilometer")

all151 <- ds(data = all15, key = "hn", formula = ~log(size), cutpoints = bins, convert.units = conversion.factor)"

and error:
"Error in .deprecated_args(c("dht.group", "region.table", "sample.table", :
Argument: convert.units is deprecated, check documentation."

All the best,
Dominik




Eric Rexstad

unread,
Apr 7, 2023, 8:48:25 AM4/7/23
to Dominik Marchowski, distance-sampling
Hello Dom, nice to hear from you again.

There are changes we introduced about a year ago in which we tried to make the naming convention for argument functions more consistent.  If you have a look at the documentation for the ds()​ function in the Distance​ package, you will discover:

convert_units - conversion between units for abundance estimation, see "Units", below. (Defaults to 1, implying all of the units are "correct" already.)

This is the source of the error message. Have a quick look through the remainder of the documentation for that function, or consult the posting we made in March 2022

to catch up on recent developments.


From: distance...@googlegroups.com <distance...@googlegroups.com> on behalf of Dominik Marchowski <march...@gmail.com>
Sent: 07 April 2023 13:22
To: distance-sampling <distance...@googlegroups.com>
Subject: [distance-sampling] Error: convert.units is deprecated
 
--
You received this message because you are subscribed to the Google Groups "distance-sampling" group.
To unsubscribe from this group and stop receiving emails from it, send an email to distance-sampl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/distance-sampling/CAPbpb8SKA-dM2Uhga7Wf7RZE%3DXdx-MAfCbkznJwAB8CMw9LcOA%40mail.gmail.com.

Dominik Marchowski

unread,
Apr 7, 2023, 8:54:28 AM4/7/23
to Eric Rexstad, distance-sampling
Thank you Eric,
It helped, such a small error and so much time spent searching. After changing the dot to underscore everything works, thank you!
Best,
Dominik
--

Dominik Marchowski, Ph.D.
Museum and Institute of Zoology, Polish Academy of Sciences. 
Wilcza 64, 00-679 Warszawa, Poland. +48.668.139.139
Reply all
Reply to author
Forward
0 new messages