there is no package called 'pls'

Everything related to the development of modules in jamovi
Post Reply
jonie_y
Posts: 2
Joined: Sun Oct 16, 2022 4:05 pm

there is no package called 'pls'

Post by jonie_y »

Hi, It is exciting that jamovi provide a way for R GUI development. but I have met some question in my module develop, and now it is 00:25 o'clock, so I have to seek for help here. And before this I have read the post below, but seems no help for me.

viewtopic.php?f=11&t=2132

My code:

Code: Select all

          X <- self$data[,self$options$var_x,drop=FALSE]
          Y <- self$data[,self$options$var_y,drop=FALSE]
          if(self$options$std==TRUE){
            X <- scale(X)
            Y <- scale(Y)
          }
          formula <- jmvcore::constructFormula('Y','X')
          formula <- as.formula(formula)
          p <- pls::mvr(formula,
                        ncomp = self$options$ncomp,
                        scale = self$options$std,
                        method = self$options$method,
                        validation = self$options$val)
Description:
I have add Add 'pls' package in import field such as:

Code: Select all

Imports: 
    jmvcore (>= 0.8.5),
    pls,
    R6
Namespace:
  • if there's only default export function, the module build successfully. but in JAMOVI, it shows error message:
there is no package called 'pls'
  • if add "import(pls)" or "importFrom(pls,mvr)", then the package(also called module) building fail.the log is:
jamovi compiler

jamovi 2.3.17 found at C:\Program Files\jamovi 2.3.17.0\bin\jamovi.exe
wrote: pls.h.R
wrote: pls.u.yaml
wrote: pls.src.js
(node:2752) [DEP0128] DeprecationWarning: Invalid 'main' field in 'E:\ProgramFiles\R\R-4.2.1\library\jmvtools\node_modules\jamovi-compiler\node_modules\po2json\package.json' of './lib/po2json'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
wrote: pls.js
writing module meta
wrote: 0000.yaml
wrote: jamovi.yaml
wrote: jamovi-full.yaml
Installing dependencies
pls
trying URL 'https://cran.microsoft.com/snapshot/202 ... _2.8-0.zip'
Content type 'application/zip' length 1271334 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

package 'pls' successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\Administrator\AppData\Local\Temp\RtmpeOsnWd\downloaded_packages
* installing *source* package 'PLS' ...
** using staged installation
Warning in as.POSIXlt.POSIXct(x, tz) : unknown timezone 'Asia/Taipei'
Warning in as.POSIXlt.POSIXct(x, tz) : unknown timezone 'GMT'
Warning in as.POSIXlt.POSIXct(x, tz) :
unknown timezone 'America/New_York'
Warning in as.POSIXlt.POSIXct(x, tz) : unknown timezone 'GMT'
Warning in as.POSIXlt.POSIXct(x, tz) :
unknown timezone 'America/New_York'
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[]) :
there is no package called 'pls'
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
ERROR: lazy loading failed for package 'PLS'
* removing 'F:/PLS/build/R4.1.2-win64/PLS'
* restoring previous 'F:/PLS/build/R4.1.2-win64/PLS'

Could not build module



Thanks a lot for your help.
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: there is no package called 'pls'

Post by jonathon »

hi,

i think this might be because your module is called PLS, and the package you're importing is pls ... the windows file system is not case sensitive, and so what i think it happening is that when it builds PLS, it overrides pls. try a different name for your module and see if that fixes it.

kind regards

jonathon
jonie_y
Posts: 2
Joined: Sun Oct 16, 2022 4:05 pm

Re: there is no package called 'pls'

Post by jonie_y »

Hi Jonathon, thanks a lot.

When I go to have a try for RJ editor, I found there's the system R and jamovi R. after checking the installation directory of jamovi, I found R is installed with jamovi. The question is solved by copy the pls package to jamovi R library directory.

Thanks very much.
Post Reply