boost-R / gamboostLSS

Boosting models for fitting generalized additive models for location, shape and scale (GAMLSS) to potentially high dimensional data. The current relase version can be found on CRAN (https://cran.r-project.org/package=gamboostLSS).
26 stars 11 forks source link

Make new dependency checks happy #1

Closed hofnerb closed 9 years ago

hofnerb commented 9 years ago

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.

hanowell commented 7 years ago

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 commented 7 years ago

@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 commented 7 years ago

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 commented 7 years ago

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...