saudiwin / ordbetareg_pack

Repository for R package ordbetareg, used to fit continuous data with lower and upper bounds.
Other
17 stars 3 forks source link

Can we remove the sf dependency? #22

Closed grantmcdermott closed 3 months ago

grantmcdermott commented 3 months ago

Thanks for this package. It looks potentially well suited to a project that I'm currently working on.

Unfortunately, I am unable to install ordbetareg because (a) I am working in a CentOS 7 environment, and (b) you have a recursive dependency on sf (via the transformr and gganimate deps). Installing sf on CentOS is huge pain because of the GDAL system dependency, which has to be configured and compiled from source.

I'm unfortunately stuck with CentOS 7 b/c of work requirements, so there's not much I can do about (a). But perhaps there's something we can do about (b)? I don't know if transformr and gganimate are playing an essential role in the core ordbetareg functionality but it seems doubtful to me. At least, requiring a hard dependency on an entire geospatial stack (both R and system-level deps) does not seem desirable for a narrowly-focused econometric package, regardless of the user's operating system.

Is there a way to split out any ancillary functionality into a separate, companion package that would remove the recursive sf dependency from ordbetareg?

Thanks for considering.

vincentarelbundock commented 3 months ago

Just here to +1 this request.

I got hit by something similar a while ago and it's annoying. Also, @grantmcdermott is definitely at the most sophisticated end of your user spectrum, @saudiwin , so this might be a win for other users too.

FWIW, I have a function to check if an optional package is installed, and then raise an error if it isn't. Very easy to implement. I can show you an example if you need it.

saudiwin commented 3 months ago

This doesn’t seem like a problem to fix (neither package is very important and I wasn’t aware of the sf dependency). @vincentarelbundock can you share this code for checking for required packages? Thanks.

vincentarelbundock commented 3 months ago

Cool! Here's the official recommendation from CRAN team: https://cran.r-project.org/doc/manuals/R-exts.html#Suggested-packages-1

Basically, just move the optional dependency to "Suggests" in DESCRIPTION. Then, call something like this:

   if (!requireNamespace("gganimate", quietly = TRUE)) {
      stop("Please install the `gganimate` package.", call. = FALSE)
   }
saudiwin commented 3 months ago

hi @grantmcdermott - I just pushed a new version (v0.7.3) without those dependencies. try that version from the Github (i.e., installing with remotes::install_github('saudiwin/idealstan'). I will close the issue but feel free to file another one if something else pops up.

grantmcdermott commented 3 months ago

Much obliged, thanks.