Plot in regression

Everything related to the development of modules in jamovi
Post Reply
vmoreno
Posts: 21
Joined: Mon Jun 05, 2017 6:04 pm

Plot in regression

Post by vmoreno »

Hi,
Instead of starting a complete new module, I cloned the Linear Regression and added a descriptive dispersion plot option.
You can test it here:

https://github.com/victor-moreno/jamovi-lmR


I work in mac with homebrew R. I had to copy the R and INSTALL scripts over the jamovi (7.3.4) distribution to make jmvtools::install() work

Victor
User avatar
jonathon
Posts: 2609
Joined: Fri Jan 27, 2017 10:04 am

Re: Plot in regression

Post by jonathon »

hey victor, that's cool!

you raise an interesting question. we've made it easy for people to write an analysis from scratch, and publish that as a separate module on the store, but i can see situations where people just want to publish a small addition to an existing analysis. i'll give this some thought.

i'm surprised you had issues with jmvtools::install(), it's fairly robust on the mac. could you describe the issues you had?

with thanks
vmoreno
Posts: 21
Joined: Mon Jun 05, 2017 6:04 pm

Re: Plot in regression

Post by vmoreno »

Hi,
Here is the mac problem:

> options(jamovi_home='~/Applications/jamovi.app')
> jmvtools::check()

jamovi compiler

jamovi found at /Users/h501uvma/Applications/jamovi.app

> jmvtools::install()
jamovi compiler

jamovi found at /Users/h501uvma/Applications/jamovi.app
wrote: linreg.h.R
wrote: linreg.src.js
wrote: linreg.js
writing module meta
wrote: 0000.yaml
wrote: jamovi.yaml
/Users/h501uvma/Applications/jamovi.app/Contents/Frameworks/R.framework/Versions/3.3/Resources/bin/INSTALL: line 34: /Users/h501uvma/Applications/jamovi.app/Contents/Frameworks/R.framework/Versions/3.3/Resources/../../../../../bin/R: No such file or directory

Could not build module

The problem is I use homebrew R, that is installed at
> R.home()
[1] "/usr/local/Cellar/r/3.4.0_1/R.framework/Resources"

And has a custom R script with modified paths. I had to overwrite R and INSTALL from /usr/local/Cellar/r/3.4.0_1/R.framework/Resources/bin
to
/Users/h501uvma/Applications/jamovi.app/Contents/Frameworks/R.framework/Resources/bin

Then install worked:
> jmvtools::install()
jamovi compiler

jamovi found at /Users/h501uvma/Applications/jamovi.app
wrote: linreg.h.R
wrote: linreg.src.js
wrote: linreg.js
writing module meta
wrote: 0000.yaml
wrote: jamovi.yaml
WARNING: ignoring environment value of R_HOME
* installing *source* package ‘lmR’ ...
** R
** preparing package for lazy loading
** help
No man pages found in package ‘lmR’
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (lmR)
wrote module: lmR.jmo

Installing lmR.jmo
jamovi
version: 0.0.0
cli: 0.0.0
ports: 51411, 51412, 51413
Module installed successfully
User avatar
jonathon
Posts: 2609
Joined: Fri Jan 27, 2017 10:04 am

Re: Plot in regression

Post by jonathon »

ah! you actually uncovered an issue with our installer build process.

if you try the latest jamovi 0.7.3.5 it should *just work*. jamovi has been designed such that your homebrew install shouldn't interfere with it.

thanks for reporting!

wrt to your dispersion plot, you could make a simple module which adds another entry into the jamovi regression menu if you liked.

cheers
vmoreno
Posts: 21
Joined: Mon Jun 05, 2017 6:04 pm

Re: Plot in regression

Post by vmoreno »

Hi Jonathon,
Sorry, but still not working. Here is the error message.
It works if I replace both R and INSTALL scripts with those from the homebrew distribution

Victor


> jmvtools::install()

jamovi compiler

jamovi found at /Applications/stat/jamovi.app
wrote: linreg.h.R
wrote: linreg.src.js
wrote: linreg.js
writing module meta
wrote: 0000.yaml
wrote: jamovi.yaml
* installing *source* package ‘lmR’ ...
** R
** preparing package for lazy loading

*** caught segfault ***
address 0x18, cause 'memory not mapped'

Traceback:
1: dyn.load(file, DLLpath = DLLpath, ...)
2: library.dynam(lib, package, package.lib)
3: loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
4: asNamespace(ns)
5: namespaceImportFrom(ns, loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]), i[[2L]], from = package)
6: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[])
7: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[]), from = package)
8: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[])
9: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[]), from = package)
10: loadNamespace(package, lib.loc, keep.source, partial = TRUE)
11: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
12: suppressPackageStartupMessages(loadNamespace(package, lib.loc, keep.source, partial = TRUE))
13: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source, compress = compress)
14: makeLazyLoading(pkg_name, lib, keep.source = keep.source)
15: doTryCatch(return(expr), name, parentenv, handler)
16: tryCatchOne(expr, names, parentenv, handlers[[1L]])
17: tryCatchList(expr, classes, parentenv, handlers)
18: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L msg <- conditionMessage(e) sm <- strsplit(msg, "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && identical(getOption("show.error.messages"), TRUE)) { cat(msg, file = stderr()) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))})
19: try({ suppressPackageStartupMessages(.getRequiredPackages(quietly = TRUE)) makeLazyLoading(pkg_name, lib, keep.source = keep.source)})
20: do_install_source(pkg_name, instdir, pkg, desc)
21: do_install(pkg)
22: tools:::.install_packages()
An irrecoverable exception occurred. R is aborting now ...
/Applications/stat/jamovi.app/Contents/Frameworks/R.framework/Versions/3.3/Resources/bin/INSTALL: line 34: 2452 Done echo 'tools:::.install_packages()'
2453 Segmentation fault: 11 | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/../../../../../bin/R" $myArgs --slave --args ${args}

Could not build module

>
User avatar
jonathon
Posts: 2609
Joined: Fri Jan 27, 2017 10:04 am

Re: Plot in regression

Post by jonathon »

hmm, that is strange.

somehow the homebrew installation must be interfering, but i have no idea how that could be.

still, i'm glad you've been able to get it working none-the-less.

jonathon
till
Posts: 1
Joined: Thu Aug 03, 2017 8:03 pm

Re: Plot in regression

Post by till »

Hi! I could not install that module as well, but got another error.

jamovi found at /Applications/jamovi.app
wrote: linreg.h.R
wrote: linreg.src.js
wrote: linreg.js
writing module meta
wrote: 0000.yaml
wrote: jamovi.yaml
* installing *source* package ‘lmR’ ...
** R
** preparing package for lazy loading
** help
No man pages found in package ‘lmR’
*** installing help indices
** building package indices
** testing if installed package can be loaded
WARNING: ignoring environment value of R_HOME
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[]) :
there is no package called ‘ggplot2’
Fehler: Laden fehlgeschlagen
Ausführung angehalten
ERROR: loading failed
* removing ‘/Users/t_utes01/R/jamovi/jamovi-lmR-master/build/R/lmR’


I have ggplot installed and also loaded, however, it does not work. Does anyone know why?
User avatar
jonathon
Posts: 2609
Joined: Fri Jan 27, 2017 10:04 am

Re: Plot in regression

Post by jonathon »

hi,

(feel free to start a new thread next time)

are you using macports/fink/homebrew at all? we've had some reports that these can interfere.

jonathon
Post Reply