Depends and Imports with OpenMx
Posted on

Forums
Hi everyone,
I am currently in the process of getting a new package on CRAN. My package uses openMx to estimate SE Models. Normally, to upload a package on CRAN, one would specify what packages are required. For example, I would put the following in my Description file:
Depends: OpenMx, MASS
Imports: OpenMx, MASS
if I had functions that use openmx and the MASS package. And in my Namespace file:
import("OpenMx", "MASS")
The problem is that R doesn't recognize OpenMx because it is not on R's repository. Does anyone know a way around this? Thanks in advance for the help.
OpenMx is still not 100% open source
Log in or register to post comments
no problem?
I'd guess you'll just need to wrap the examples in don't run tags..
Add an INSTALL maybe to help people find OpenMx, and document the requirement and manual element in yourName-package.Rd
setwd("~/bin/yourpackage/");
devtools::check()
FYI, other stuff I use a bit (but have not yet pushed to cran with...) is
setwd("~/bin/umx/umx"); devtools::document(); devtools::install();
devtools::load_all()
devtools::dev_help("yourFun")
https://github.com/hadley/devtools
https://github.com/hadley/devtools/wiki/Philosophy
Log in or register to post comments
In reply to no problem? by tbates
require in functions
* checking for unstated dependencies in R code . . . WARNING 'library' or 'require' call not declared from: 'OpenMx'
Any ideas?
Log in or register to post comments
In reply to require in functions by fife
Warning or Error?
Log in or register to post comments
In reply to Warning or Error? by mhunter
require() should return FALSE and give a warning
You can use a snippet like:
hasOpenMx <- suppressWarnings(require("OpenMx"))
if(!hasOpenMx) {
stop(paste("This package uses OpenMx, but you do not currently have it installed. ",
"You can get it by visiting [http://openmx.psyc.virginia.edu/installing-openmx] and",
"following the instructions there.")
}
Or whatever you'd like to happen in the case that OpenMx doesn't load. The require() command above won't say anything if it fails. If you don't want it to say anything on success either, you can wrap the suppressWarnings() in a suppressMessages() as well.
Log in or register to post comments
In reply to require() should return FALSE and give a warning by tbrick
submit and see
There must be a way, because semTools suggests OpenMx and is up on cran
https://github.com/simsem/semTools/wiki
I'd love to hear how this works out
Log in or register to post comments
In reply to require in functions by fife
How are you using require()?
Another avenue might be to see how packages on CRAN which augment OpenMx like semtools handle the issue.
Log in or register to post comments