michaelhallquist / MplusAutomation

The MplusAutomation package leverages the flexibility of the R language to automate latent variable model estimation and interpretation using Mplus, a powerful latent variable modeling program developed by Muthen and Muthen (www.statmodel.com). Specifically, MplusAutomation provides routines for creating related groups of models, running batches of models, and extracting and tabulating model parameters and fit statistics.
81 stars 46 forks source link

Some problem with detecting fastDummies being installed (macOS, Macports) #186

Closed barracuda156 closed 1 year ago

barracuda156 commented 1 year ago

I get this when running check:

* checking package dependencies ... ERROR
Package required but not available: ‘fastDummies’

See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’
manual.
* DONE

Status: 1 ERROR

Yet it is installed in fact:

10:~ svacchanda$ port -v installed R-fastDummies
The following ports are currently installed:
  R-fastDummies @1.6.3_0 (active) requested_variants='' platform='darwin 10' archs='noarch' date='2023-04-24T16:48:27+0800'

Any idea why it cannot find specifically this dependency?

michaelhallquist commented 1 year ago

I don't quite know why that would happen, but it's not an issue with MplusAutomation per se. The package dependency checks happen as a standard part of package installation and are handled at the base R level. I wonder if the .libPaths() for your installation are not correct and do not point to the location of where MacPorts placed fastDummies? I'd try library(fastDummies) in an R session and also installed.packages()["fastDummies",] to see if R registers the package installation and location.

Hope this helps, Michael

barracuda156 commented 1 year ago

@michaelhallquist Thank you, you are right, something is broken with fastDummies:

> library(fastDummies)
Error in library(fastDummies) : there is no package called ‘fastDummies’

Could you say where libPaths are usually set? It turned out that several packages are broken in this manner (not many, but more than one).

michaelhallquist commented 1 year ago

If you have non-standard locations for your R packages, you can use the .libPaths function. For example, in my lab, we use this to have a central location for all packages. I place this code in ~/.Rprofile so that it runs when R starts:

rv <- R.Version()
if (rv$major == "4" && rv$minor == ".0.3") {
  lab_packages <- "/proj/mnhallqlab/lab_resources/lab_rpackages_v403"
} else if  (rv$major == "4" && rv$minor == ".1.2") {
  lab_packages <- "/proj/mnhallqlab/lab_resources/lab_rpackages_v412"
} else if  (rv$major == "4" && rv$minor == ".2.1") {
  lab_packages <- "/proj/mnhallqlab/lab_resources/lab_rpackages_v421"
} else {
  lab_packages <- NULL
}

if (!is.null(lab_packages) && !lab_packages %in% .libPaths()) {  .libPaths(c(lab_packages, .libPaths())) }
barracuda156 commented 1 year ago

Any idea what this means? (Sorry, should have checked this straight-away, this sounds at least more specific.)

> installed.packages()["fastDummies",]
Error in installed.packages()["fastDummies", ] : subscript out of bounds
michaelhallquist commented 1 year ago

Probably that R doesn't see the package at all at the moment. You can drop the row subset to see all installed packages: installed.packages()

barracuda156 commented 1 year ago

Probably that R doesn't see the package at all at the moment. You can drop the row subset to see all installed packages: installed.packages()

@michaelhallquist Found the reason, thank you again.

P. S. For anyone bumping into this: https://trac.macports.org/ticket/67299