[R-pkg-devel] rgdal not available for checking
Hi, I'm working on submitting an update to an existing R package to CRAN. I've tested it with R CMD check --as-cran and it passes with no errors, warnings or notes. But there is an error currently on the check results page for the current version, which you can see here: https://cran.r-project.org/web/checks/check_results_envirem.html The error is only for the r-release-osx-x86_64 platform, where the problem is "Package suggested but not available for checking: ‘rgdal’". I'm not sure what the problem is, as rgdal is a package on CRAN, and I can't seem to reproduce this problem on the different platforms that I have run R CMD check on, which as mac osx, ubuntu and win-builder. I imagine that the same problem will crop up with the updated version of the package. I've googled the error message, and it looks like there are many R packages with the same issue. Any suggestions for how to deal with this would be great. I could rewrite parts of my R package to avoid the use of rgdal in the examples, but that's working around the problem rather than addressing it. thanks! -Pascal [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
[R-pkg-devel] define an environment in .onLoad
Hi, I am developing an R package where I would like to have a set of names defined once, and which could then be queried from within the various functions of the package. The way I have currently set this up is to define a new environment that contains these names. So, what I currently have is: .var <- new.env() .var$bio <- "bio_" .var$tmin <- "tmin_" .var$tmax <- "tmax_" What I would like is that this environment be created when the R package is loaded. That way, default values are automatically in place, and if the user would like to change the naming that they use for tmin, for example, they would just need to do (for example): .var$tmin <- ‘minTemp_' And then these names can be accessed from within any of the functions, and this is unlikely to conflict with any R objects the user is defining. Where I am stuck is how/where to define this new environment such that it is made available when the package is loaded. I tried including the following in R/zzz.R: .onLoad <- function(libname, pkgname) { # define a custom environment for defining the naming of variables .var <- new.env() # default .var$bio <- "bio_" .var$tmin <- "tmin_" .var$tmax <- "tmax_" invisible() } But if I build/install the package, the .var environment is not already created. Any suggestions? Thanks! -Pascal [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] define an environment in .onLoad
Thank you! I had actually tried that, but forgot to export that additional R script. This makes sense. On January 29, 2019 at 16:47:20, Gábor Csárdi (csardi.ga...@gmail.com) wrote: You don't need .onLoad for this, just put the environment into the package environment. E.g. simply add pkg_data <- new.env(parent = emptyenv()) to your package code. Then you can refer to pkg_data from the functions in the package. Best, Gabor On Tue, Jan 29, 2019 at 9:40 PM Pascal Title wrote: > > Hi, > > I am developing an R package where I would like to have a set of names > defined once, and which could then be queried from within the various > functions of the package. The way I have currently set this up is to define > a new environment that contains these names. > > So, what I currently have is: > > .var <- new.env() > > .var$bio <- "bio_" > > .var$tmin <- "tmin_" > > .var$tmax <- "tmax_" > > What I would like is that this environment be created when the R package is > loaded. That way, default values are automatically in place, and if the > user would like to change the naming that they use for tmin, for example, > they would just need to do (for example): > > > .var$tmin <- ‘minTemp_' > > > And then these names can be accessed from within any of the functions, and > this is unlikely to conflict with any R objects the user is defining. > > > Where I am stuck is how/where to define this new environment such that it > is made available when the package is loaded. I tried including the > following in R/zzz.R: > > > .onLoad <- function(libname, pkgname) { > > > # define a custom environment for defining the naming of variables > > .var <- new.env() > > # default > > .var$bio <- "bio_" > > .var$tmin <- "tmin_" > > .var$tmax <- "tmax_" > > invisible() > > } > > > But if I build/install the package, the .var environment is not already > created. Any suggestions? > > > Thanks! > > -Pascal > > [[alternative HTML version deleted]] > > __ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel