Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make new dependency checks happy #1

Closed
hofnerb opened this issue Jul 3, 2015 · 4 comments
Closed

Make new dependency checks happy #1

hofnerb opened this issue Jul 3, 2015 · 4 comments

Comments

@hofnerb
Copy link
Member

hofnerb commented Jul 3, 2015

To make the new dependency checks on CRAN happy go along the following recipe (as suggested by Kurt Hornik).

1.) Copy the functions listed after Undefined global functions or variables: in the output from R CMD check in a variable txt:

txt <- "axis box coef dlogis dnorm fitted grey lines median optimize plogis
     plot pnorm points predict qlnorm qlogis qnorm qt qweibull rgb
     rmultinom tail update var weighted.mean"

2.) With the function

imports_for_undefined_globals <- function(txt, lst, selective = TRUE) {
    if(!missing(txt))
        lst <- scan(what = character(), text = txt, quiet = TRUE)
    nms <- lapply(lst, find)
    ind <- sapply(nms, length) > 0L
    imp <- split(lst[ind], substring(unlist(nms[ind]), 9L))
    if(selective) {
        sprintf("importFrom(%s)",
                vapply(Map(c, names(imp), imp),
                       function(e)
                           paste0("\"", e, "\"", collapse = ", "),
                       ""))
    } else {
        sprintf("import(\"%s\")", names(imp))
    }
}

one can obtain the imports via

writeLines(imports_for_undefined_globals(txt))

3.) Copy and paste the output to NAMESPACE.
4.) Add the packages to Imports in DESCRIPTION.

@hofnerb hofnerb closed this as completed in 7d4a7a0 Jul 3, 2015
@hanowell
Copy link

hanowell commented Jul 11, 2017

edit Scratch that. This can't be the reason.

I believe this issue is related to an issue I've started having building a package that imports gamboostLSS and mboost. Before R version 3.4.0, it worked fine. Now I cannot build the package and get the following error:

Error in (function (dep_name, dep_ver = NA, dep_compare = NA) :
Dependency package gamboostLSS not available.

I think I'm going to have to go back to a previous R version and version of all packages it imports and depends on in order for my package to no longer be broken.

@hanowell
Copy link

@hofnerb, I am still having trouble with my package, which depends on gamboostLSS. I have the latest versions of R and gamboostLSS (and all of its dependencies) installed as of R 3.4.1. I am importing both gamboostLSS and mboost. I'm using roxygen2 to build my package. I've confirmed that gamboostLSS is indeed the issue blocking a build of my package (by removing the imports from DESCRIPTION and NAMESPACE). Do I need to follow this recipe for gamboostLSS to work in my package?

@hofnerb
Copy link
Member Author

hofnerb commented Jul 12, 2017

The above solution is only with regard to imported functions and was only there to get rid of a warning in the process of building / testing... So as you already figured out (if I understand the timing of your posts correctly) this cannot be the reason.

I am having such problems when the library used for building/testing is not the standard library. I do not really know how and when this happens but it does. Sometimes it helps to switch from devtools to standard R tools (or vice versa, I am not sure) and / or to ignore that issue and rely on testing on travis-ci, appveyor (both via github) or win-builder (simply upload your package).

Does this help or is it a real bug?

@hofnerb
Copy link
Member Author

hofnerb commented Jul 12, 2017

Btw. I do not understand why gamboostLSS would block building your package (if you do not re-build vignettes which depend on gamboostlSS). For me such errors just occur when testing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants