[R-pkg-devel] no visible global function definition

2015-06-29 Thread Daniel Lüdecke
Hello,

I'm doing my package check for CRAN, in order to see whether submitting the
package-update passes all checks.
I'm doing the tests under Windows 7, using R-Version "R Under development
(unstable) (2015-06-28 r68602)".

Now I got a quite long list of NOTEs, which are probably no problem,
however, I would like to fix these issues, if possible.

It seems that all base and/or stats function now produce a note concering
the visible global function definition. Here's a short example of my output
from my package check:

sjp.grpfrq: no visible global function definition for 'sd'
sjp.grpfrq: no visible global function definition for 'plot'
sjp.int: no visible global function definition for 'sd'
sjp.int: no visible global function definition for 'quantile'
sjp.int: no visible global function definition for 'plogis'
sjp.likert: no visible global function definition for 'xtabs'
sjp.likert: no visible binding for global variable 'offset'
sjp.likert: no visible global function definition for 'plot'
sjp.lm: no visible global function definition for 'coef'
sjp.lm: no visible global function definition for 'coefficients'
sjp.lm: no visible global function definition for 'confint'
sjp.lm.eff: no visible global function definition for 'model.matrix'

Do I have to import all these namespaces now? I'm using RStudio with
roxygen, so I would add an @importFrom stats  where necessary
- but is this the new requirement as of R >= 3.3?

Best wishes
Daniel




--

_

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; 
Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr. Dr. Uwe 
Koch-Gromus, Joachim Prölß, Rainer Schoppik
_

SAVE PAPER - THINK BEFORE PRINTING

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] appropriate directory for data downloads in examples, demos and vignettes

2015-06-29 Thread Jonathan Callahan
Hi,

The MazamaSpatialUtils
 package has a
required "package state" variable which users set to specify where they
want to store large amounts of GIS data that is being downloaded and
converted by the package. The implementation of this follows Hadley's
advice here:

http://adv-r.had.co.nz/Environments.html#explicit-envs

The functionality is implemented with package environment and getter and
setter functions:

spatialEnv <- new.env(parent = emptyenv())
spatialEnv$dataDir <- NULL


getSpatialDataDir <- function() {
  if (is.null(spatialEnv$dataDir)) {
stop('No data directory found. Please set a data directory with
setSpatialDataDir("YOUR_DATA_DIR").',call.=FALSE)
  } else {
return(spatialEnv$dataDir)
  }
}


setSpatialDataDir <- function(dataDir) {
  old <- spatialEnv$dataDir
  dataDir <- path.expand(dataDir)
  tryCatch({
if (!file.exists(dataDir)) dir.create(dataDir)
spatialEnv$dataDir <- dataDir
  }, warning = function(warn) {
warning("Invalid path name.")
  }, error   = function(err) {
stop(paste0("Error in setSpatialDataDir(",dataDir,")."))
  })
  return(invisible(old))
}


My question is:

*What is an appropriate directory to specify for vignettes (or demos or
examples) that need to go through CRAN testing?*

The R code in vignettes need to specify a directory that is writable during
the package build process but that will also be available to users.

Should we create a /tmp/ directory? Would that be available on all
systems?

Alternatively,

*What is an alternative to vignettes and demos for tutorial scripts that
should not be tested upon submission to CRAN?*


Thanks for any suggestions.

Jon


-- 
Jonathan Callahan, PhD
Mazama Science
206-708-5028
mazamascience.com

[[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] no visible global function definition

2015-06-29 Thread Uwe Ligges



On 29.06.2015 11:10, Daniel Lüdecke wrote:

Hello,

I'm doing my package check for CRAN, in order to see whether submitting the
package-update passes all checks.
I'm doing the tests under Windows 7, using R-Version "R Under development
(unstable) (2015-06-28 r68602)".

Now I got a quite long list of NOTEs, which are probably no problem,
however, I would like to fix these issues, if possible.

It seems that all base and/or stats function now produce a note concering
the visible global function definition. Here's a short example of my output
from my package check:

sjp.grpfrq: no visible global function definition for 'sd'
sjp.grpfrq: no visible global function definition for 'plot'
sjp.int: no visible global function definition for 'sd'
sjp.int: no visible global function definition for 'quantile'
sjp.int: no visible global function definition for 'plogis'
sjp.likert: no visible global function definition for 'xtabs'
sjp.likert: no visible binding for global variable 'offset'
sjp.likert: no visible global function definition for 'plot'
sjp.lm: no visible global function definition for 'coef'
sjp.lm: no visible global function definition for 'coefficients'
sjp.lm: no visible global function definition for 'confint'
sjp.lm.eff: no visible global function definition for 'model.matrix'

Do I have to import all these namespaces now? I'm using RStudio with
roxygen, so I would add an @importFrom stats  where necessary
- but is this the new requirement as of R >= 3.3?


Yes. And it should have been a requirement before, I believe.

Best,
Uwe Ligges




Best wishes
Daniel




--

_

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; 
Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr. Dr. Uwe 
Koch-Gromus, Joachim Prölß, Rainer Schoppik
_

SAVE PAPER - THINK BEFORE PRINTING

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] appropriate directory for data downloads in examples, demos and vignettes

2015-06-29 Thread Neal Fultz
I would use tempfile() instead of /tmp/. That should create a
file/directory that will get cleaned up when the R session ends, instead of
when the machine reboots. AFAIK it also works on windows.

On Mon, Jun 29, 2015 at 8:25 AM, Jonathan Callahan <
jonat...@mazamascience.com> wrote:

> Hi,
>
> The MazamaSpatialUtils
>  package has a
> required "package state" variable which users set to specify where they
> want to store large amounts of GIS data that is being downloaded and
> converted by the package. The implementation of this follows Hadley's
> advice here:
>
> http://adv-r.had.co.nz/Environments.html#explicit-envs
>
> The functionality is implemented with package environment and getter and
> setter functions:
>
> spatialEnv <- new.env(parent = emptyenv())
> spatialEnv$dataDir <- NULL
>
>
> getSpatialDataDir <- function() {
>   if (is.null(spatialEnv$dataDir)) {
> stop('No data directory found. Please set a data directory with
> setSpatialDataDir("YOUR_DATA_DIR").',call.=FALSE)
>   } else {
> return(spatialEnv$dataDir)
>   }
> }
>
>
> setSpatialDataDir <- function(dataDir) {
>   old <- spatialEnv$dataDir
>   dataDir <- path.expand(dataDir)
>   tryCatch({
> if (!file.exists(dataDir)) dir.create(dataDir)
> spatialEnv$dataDir <- dataDir
>   }, warning = function(warn) {
> warning("Invalid path name.")
>   }, error   = function(err) {
> stop(paste0("Error in setSpatialDataDir(",dataDir,")."))
>   })
>   return(invisible(old))
> }
>
>
> My question is:
>
> *What is an appropriate directory to specify for vignettes (or demos or
> examples) that need to go through CRAN testing?*
>
> The R code in vignettes need to specify a directory that is writable during
> the package build process but that will also be available to users.
>
> Should we create a /tmp/ directory? Would that be available on all
> systems?
>
> Alternatively,
>
> *What is an alternative to vignettes and demos for tutorial scripts that
> should not be tested upon submission to CRAN?*
>
>
> Thanks for any suggestions.
>
> Jon
>
>
> --
> Jonathan Callahan, PhD
> Mazama Science
> 206-708-5028
> mazamascience.com
>
> [[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


Re: [R-pkg-devel] appropriate directory for data downloads in examples, demos and vignettes

2015-06-29 Thread Stachelek, Joseph
Following the answer posted by 'James' at: 
http://stackoverflow.com/questions/12598242/global-variables-in-packages-in-r

I have the user set the data directory by editing a file (yourdatadirpath) 
which is then read into options() on package load.

.onLoad<-function(libname=find.package("datapkg"),pkgname="datapkg"){
options("yourdatadir"=matrix(utils::read.delim(system.file("yourdatadirpath",package="datapkg"),header=FALSE,stringsAsFactors=FALSE))[[1]][1])
}


-Original Message-
From: R-package-devel [mailto:r-package-devel-boun...@r-project.org] On Behalf 
Of Neal Fultz
Sent: Monday, June 29, 2015 12:06 PM
To: Jonathan Callahan
Cc: r-package-devel@r-project.org
Subject: Re: [R-pkg-devel] appropriate directory for data downloads in 
examples, demos and vignettes

I would use tempfile() instead of /tmp/. That should create a
file/directory that will get cleaned up when the R session ends, instead of
when the machine reboots. AFAIK it also works on windows.

On Mon, Jun 29, 2015 at 8:25 AM, Jonathan Callahan <
jonat...@mazamascience.com> wrote:

> Hi,
>
> The MazamaSpatialUtils
>  package has a
> required "package state" variable which users set to specify where they
> want to store large amounts of GIS data that is being downloaded and
> converted by the package. The implementation of this follows Hadley's
> advice here:
>
> http://adv-r.had.co.nz/Environments.html#explicit-envs
>
> The functionality is implemented with package environment and getter and
> setter functions:
>
> spatialEnv <- new.env(parent = emptyenv())
> spatialEnv$dataDir <- NULL
>
>
> getSpatialDataDir <- function() {
>   if (is.null(spatialEnv$dataDir)) {
> stop('No data directory found. Please set a data directory with
> setSpatialDataDir("YOUR_DATA_DIR").',call.=FALSE)
>   } else {
> return(spatialEnv$dataDir)
>   }
> }
>
>
> setSpatialDataDir <- function(dataDir) {
>   old <- spatialEnv$dataDir
>   dataDir <- path.expand(dataDir)
>   tryCatch({
> if (!file.exists(dataDir)) dir.create(dataDir)
> spatialEnv$dataDir <- dataDir
>   }, warning = function(warn) {
> warning("Invalid path name.")
>   }, error   = function(err) {
> stop(paste0("Error in setSpatialDataDir(",dataDir,")."))
>   })
>   return(invisible(old))
> }
>
>
> My question is:
>
> *What is an appropriate directory to specify for vignettes (or demos or
> examples) that need to go through CRAN testing?*
>
> The R code in vignettes need to specify a directory that is writable during
> the package build process but that will also be available to users.
>
> Should we create a /tmp/ directory? Would that be available on all
> systems?
>
> Alternatively,
>
> *What is an alternative to vignettes and demos for tutorial scripts that
> should not be tested upon submission to CRAN?*
>
>
> Thanks for any suggestions.
>
> Jon
>
>
> --
> Jonathan Callahan, PhD
> Mazama Science
> 206-708-5028
> mazamascience.com
>
> [[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


We value your opinion. Please take a few minutes to shar...{{dropped:5}}

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] appropriate directory for data downloads in examples, demos and vignettes

2015-06-29 Thread Paul Gilbert
Regarding alternative places for scripts, you can add a directory (eg 
inst/testLocalScripts) and then with a recently added R CMD feature you 
can do


 R CMD check --test-dir=inst/testLocalScripts your-package.tar.gz

This will not (automatically) be checked on CRAN. Beware that you also 
need to run R CMD check without this option to run your regular tests.


Paul


On 06/29/2015 11:25 AM, Jonathan Callahan wrote:

Hi,

The MazamaSpatialUtils
 package has a
required "package state" variable which users set to specify where they
want to store large amounts of GIS data that is being downloaded and
converted by the package. The implementation of this follows Hadley's
advice here:

http://adv-r.had.co.nz/Environments.html#explicit-envs

The functionality is implemented with package environment and getter and
setter functions:

spatialEnv <- new.env(parent = emptyenv())
spatialEnv$dataDir <- NULL


getSpatialDataDir <- function() {
   if (is.null(spatialEnv$dataDir)) {
 stop('No data directory found. Please set a data directory with
setSpatialDataDir("YOUR_DATA_DIR").',call.=FALSE)
   } else {
 return(spatialEnv$dataDir)
   }
}


setSpatialDataDir <- function(dataDir) {
   old <- spatialEnv$dataDir
   dataDir <- path.expand(dataDir)
   tryCatch({
 if (!file.exists(dataDir)) dir.create(dataDir)
 spatialEnv$dataDir <- dataDir
   }, warning = function(warn) {
 warning("Invalid path name.")
   }, error   = function(err) {
 stop(paste0("Error in setSpatialDataDir(",dataDir,")."))
   })
   return(invisible(old))
}


My question is:

*What is an appropriate directory to specify for vignettes (or demos or
examples) that need to go through CRAN testing?*

The R code in vignettes need to specify a directory that is writable during
the package build process but that will also be available to users.

Should we create a /tmp/ directory? Would that be available on all
systems?

Alternatively,

*What is an alternative to vignettes and demos for tutorial scripts that
should not be tested upon submission to CRAN?*


Thanks for any suggestions.

Jon




__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] no visible global function definition

2015-06-29 Thread Kevin Ushey
Hi Uwe,

It seems like this is quite a major change; I imagine it will affect many
packages (since lots of packages implicitly assume other 'base' packages,
like 'utils', will always be available in an R session). IIUC, in the
latest versions of R-devel, only the 'base' package can be assumed
available; everything else must be explicitly imported.

https://github.com/wch/r-source/commit/dba5a49dcae7e9bcb8528cf78fd9d51f092652b2

Is there any chance that such changes could be made in announcements on
R-pkg-devel? Or, as an aside, would it be permissible for non-R-core
members to make such announcements on this list?

Thanks,
Kevin

On Mon, Jun 29, 2015 at 8:46 AM, Uwe Ligges  wrote:

>
>
> On 29.06.2015 11:10, Daniel Lüdecke wrote:
>
>> Hello,
>>
>> I'm doing my package check for CRAN, in order to see whether submitting
>> the
>> package-update passes all checks.
>> I'm doing the tests under Windows 7, using R-Version "R Under development
>> (unstable) (2015-06-28 r68602)".
>>
>> Now I got a quite long list of NOTEs, which are probably no problem,
>> however, I would like to fix these issues, if possible.
>>
>> It seems that all base and/or stats function now produce a note concering
>> the visible global function definition. Here's a short example of my
>> output
>> from my package check:
>>
>> sjp.grpfrq: no visible global function definition for 'sd'
>> sjp.grpfrq: no visible global function definition for 'plot'
>> sjp.int: no visible global function definition for 'sd'
>> sjp.int: no visible global function definition for 'quantile'
>> sjp.int: no visible global function definition for 'plogis'
>> sjp.likert: no visible global function definition for 'xtabs'
>> sjp.likert: no visible binding for global variable 'offset'
>> sjp.likert: no visible global function definition for 'plot'
>> sjp.lm: no visible global function definition for 'coef'
>> sjp.lm: no visible global function definition for 'coefficients'
>> sjp.lm: no visible global function definition for 'confint'
>> sjp.lm.eff: no visible global function definition for 'model.matrix'
>>
>> Do I have to import all these namespaces now? I'm using RStudio with
>> roxygen, so I would add an @importFrom stats  where
>> necessary
>> - but is this the new requirement as of R >= 3.3?
>>
>
> Yes. And it should have been a requirement before, I believe.
>
> Best,
> Uwe Ligges
>
>
>
>
>> Best wishes
>> Daniel
>>
>>
>>
>>
>> --
>>
>> _
>>
>> Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen
>> Rechts; Gerichtsstand: Hamburg | www.uke.de
>> Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr.
>> Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
>> _
>>
>> SAVE PAPER - THINK BEFORE PRINTING
>>
>> __
>> R-package-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
>>
> __
> 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


Re: [R-pkg-devel] no visible global function definition

2015-06-29 Thread Neal Fultz
There's https://twitter.com/cranpolicywatch

I wouldn't mind if that got forwarded to r-package-devel, as I'm not on
twitter myself.



On Mon, Jun 29, 2015 at 10:09 AM, Kevin Ushey  wrote:

> Hi Uwe,
>
> It seems like this is quite a major change; I imagine it will affect many
> packages (since lots of packages implicitly assume other 'base' packages,
> like 'utils', will always be available in an R session). IIUC, in the
> latest versions of R-devel, only the 'base' package can be assumed
> available; everything else must be explicitly imported.
>
>
> https://github.com/wch/r-source/commit/dba5a49dcae7e9bcb8528cf78fd9d51f092652b2
>
> Is there any chance that such changes could be made in announcements on
> R-pkg-devel? Or, as an aside, would it be permissible for non-R-core
> members to make such announcements on this list?
>
> Thanks,
> Kevin
>
> On Mon, Jun 29, 2015 at 8:46 AM, Uwe Ligges <
> lig...@statistik.tu-dortmund.de
> > wrote:
>
> >
> >
> > On 29.06.2015 11:10, Daniel Lüdecke wrote:
> >
> >> Hello,
> >>
> >> I'm doing my package check for CRAN, in order to see whether submitting
> >> the
> >> package-update passes all checks.
> >> I'm doing the tests under Windows 7, using R-Version "R Under
> development
> >> (unstable) (2015-06-28 r68602)".
> >>
> >> Now I got a quite long list of NOTEs, which are probably no problem,
> >> however, I would like to fix these issues, if possible.
> >>
> >> It seems that all base and/or stats function now produce a note
> concering
> >> the visible global function definition. Here's a short example of my
> >> output
> >> from my package check:
> >>
> >> sjp.grpfrq: no visible global function definition for 'sd'
> >> sjp.grpfrq: no visible global function definition for 'plot'
> >> sjp.int: no visible global function definition for 'sd'
> >> sjp.int: no visible global function definition for 'quantile'
> >> sjp.int: no visible global function definition for 'plogis'
> >> sjp.likert: no visible global function definition for 'xtabs'
> >> sjp.likert: no visible binding for global variable 'offset'
> >> sjp.likert: no visible global function definition for 'plot'
> >> sjp.lm: no visible global function definition for 'coef'
> >> sjp.lm: no visible global function definition for 'coefficients'
> >> sjp.lm: no visible global function definition for 'confint'
> >> sjp.lm.eff: no visible global function definition for 'model.matrix'
> >>
> >> Do I have to import all these namespaces now? I'm using RStudio with
> >> roxygen, so I would add an @importFrom stats  where
> >> necessary
> >> - but is this the new requirement as of R >= 3.3?
> >>
> >
> > Yes. And it should have been a requirement before, I believe.
> >
> > Best,
> > Uwe Ligges
> >
> >
> >
> >
> >> Best wishes
> >> Daniel
> >>
> >>
> >>
> >>
> >> --
> >>
> >> _
> >>
> >> Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen
> >> Rechts; Gerichtsstand: Hamburg | www.uke.de
> >> Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr.
> >> Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
> >> _
> >>
> >> SAVE PAPER - THINK BEFORE PRINTING
> >>
> >> __
> >> R-package-devel@r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> >>
> >>
> > __
> > 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
>

[[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] no visible global function definition

2015-06-29 Thread Zhian Kamvar
Does this also mean that we now need to include these packages (stats, 
graphics, etc) in the Imports field of the DESCRIPTION?

Thanks,
Zhian
> On Jun 29, 2015, at 10:09 , Kevin Ushey  wrote:
> 
> Hi Uwe,
> 
> It seems like this is quite a major change; I imagine it will affect many
> packages (since lots of packages implicitly assume other 'base' packages,
> like 'utils', will always be available in an R session). IIUC, in the
> latest versions of R-devel, only the 'base' package can be assumed
> available; everything else must be explicitly imported.
> 
> https://github.com/wch/r-source/commit/dba5a49dcae7e9bcb8528cf78fd9d51f092652b2
> 
> Is there any chance that such changes could be made in announcements on
> R-pkg-devel? Or, as an aside, would it be permissible for non-R-core
> members to make such announcements on this list?
> 
> Thanks,
> Kevin
> 
> On Mon, Jun 29, 2015 at 8:46 AM, Uwe Ligges > wrote:
> 
>> 
>> 
>> On 29.06.2015 11:10, Daniel Lüdecke wrote:
>> 
>>> Hello,
>>> 
>>> I'm doing my package check for CRAN, in order to see whether submitting
>>> the
>>> package-update passes all checks.
>>> I'm doing the tests under Windows 7, using R-Version "R Under development
>>> (unstable) (2015-06-28 r68602)".
>>> 
>>> Now I got a quite long list of NOTEs, which are probably no problem,
>>> however, I would like to fix these issues, if possible.
>>> 
>>> It seems that all base and/or stats function now produce a note concering
>>> the visible global function definition. Here's a short example of my
>>> output
>>> from my package check:
>>> 
>>> sjp.grpfrq: no visible global function definition for 'sd'
>>> sjp.grpfrq: no visible global function definition for 'plot'
>>> sjp.int: no visible global function definition for 'sd'
>>> sjp.int: no visible global function definition for 'quantile'
>>> sjp.int: no visible global function definition for 'plogis'
>>> sjp.likert: no visible global function definition for 'xtabs'
>>> sjp.likert: no visible binding for global variable 'offset'
>>> sjp.likert: no visible global function definition for 'plot'
>>> sjp.lm: no visible global function definition for 'coef'
>>> sjp.lm: no visible global function definition for 'coefficients'
>>> sjp.lm: no visible global function definition for 'confint'
>>> sjp.lm.eff: no visible global function definition for 'model.matrix'
>>> 
>>> Do I have to import all these namespaces now? I'm using RStudio with
>>> roxygen, so I would add an @importFrom stats  where
>>> necessary
>>> - but is this the new requirement as of R >= 3.3?
>>> 
>> 
>> Yes. And it should have been a requirement before, I believe.
>> 
>> Best,
>> Uwe Ligges
>> 
>> 
>> 
>> 
>>> Best wishes
>>> Daniel
>>> 
>>> 
>>> 
>>> 
>>> --
>>> 
>>> _
>>> 
>>> Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen
>>> Rechts; Gerichtsstand: Hamburg | www.uke.de
>>> Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr.
>>> Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
>>> _
>>> 
>>> SAVE PAPER - THINK BEFORE PRINTING
>>> 
>>> __
>>> R-package-devel@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>> 
>>> 
>> __
>> 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

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] no visible global function definition

2015-06-29 Thread Duncan Murdoch
On 29/06/2015 7:09 PM, Kevin Ushey wrote:
> Hi Uwe,
> 
> It seems like this is quite a major change; I imagine it will affect many
> packages (since lots of packages implicitly assume other 'base' packages,
> like 'utils', will always be available in an R session). IIUC, in the
> latest versions of R-devel, only the 'base' package can be assumed
> available; everything else must be explicitly imported.
> 
> https://github.com/wch/r-source/commit/dba5a49dcae7e9bcb8528cf78fd9d51f092652b2
> 
> Is there any chance that such changes could be made in announcements on
> R-pkg-devel? Or, as an aside, would it be permissible for non-R-core
> members to make such announcements on this list?

It was announced in the NEWS which is online here:

http://developer.r-project.org/blosxom.cgi/R-devel/NEWS

and available as an RSS feed.  (If you prefer Twitter, feel free to
mirror the RSS feed there, if that's possible.  I don't use Twitter, so
I won't do it.)  It seems to have become known here essentially
immediately, so I'm not sure how an announcement would help.

For the reasoning:  there's been a general trend to making sure packages
work even when other packages don't use library() or require() to attach
them.  This is a logical step in that direction.  If your function foo()
uses the graphics plot() function but doesn't explicitly import it, then
your function will fail if a user tries to run it while graphics isn't
attached.  I suspect dispatch may also be faster if it is imported than
if R has to search through everything on the search list.

Duncan Murdoch

> 
> Thanks,
> Kevin
> 
> On Mon, Jun 29, 2015 at 8:46 AM, Uwe Ligges > wrote:
> 
>>
>>
>> On 29.06.2015 11:10, Daniel Lüdecke wrote:
>>
>>> Hello,
>>>
>>> I'm doing my package check for CRAN, in order to see whether submitting
>>> the
>>> package-update passes all checks.
>>> I'm doing the tests under Windows 7, using R-Version "R Under development
>>> (unstable) (2015-06-28 r68602)".
>>>
>>> Now I got a quite long list of NOTEs, which are probably no problem,
>>> however, I would like to fix these issues, if possible.
>>>
>>> It seems that all base and/or stats function now produce a note concering
>>> the visible global function definition. Here's a short example of my
>>> output
>>> from my package check:
>>>
>>> sjp.grpfrq: no visible global function definition for 'sd'
>>> sjp.grpfrq: no visible global function definition for 'plot'
>>> sjp.int: no visible global function definition for 'sd'
>>> sjp.int: no visible global function definition for 'quantile'
>>> sjp.int: no visible global function definition for 'plogis'
>>> sjp.likert: no visible global function definition for 'xtabs'
>>> sjp.likert: no visible binding for global variable 'offset'
>>> sjp.likert: no visible global function definition for 'plot'
>>> sjp.lm: no visible global function definition for 'coef'
>>> sjp.lm: no visible global function definition for 'coefficients'
>>> sjp.lm: no visible global function definition for 'confint'
>>> sjp.lm.eff: no visible global function definition for 'model.matrix'
>>>
>>> Do I have to import all these namespaces now? I'm using RStudio with
>>> roxygen, so I would add an @importFrom stats  where
>>> necessary
>>> - but is this the new requirement as of R >= 3.3?
>>>
>>
>> Yes. And it should have been a requirement before, I believe.
>>
>> Best,
>> Uwe Ligges
>>
>>
>>
>>
>>> Best wishes
>>> Daniel
>>>
>>>
>>>
>>>
>>> --
>>>
>>> _
>>>
>>> Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen
>>> Rechts; Gerichtsstand: Hamburg | www.uke.de
>>> Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr.
>>> Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
>>> _
>>>
>>> SAVE PAPER - THINK BEFORE PRINTING
>>>
>>> __
>>> R-package-devel@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>>
>>>
>> __
>> 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
>

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] no visible global function definition

2015-06-29 Thread Jonathan Callahan
Dan,

I find it useful to reference external functions as package::function()
throughout all of our R code. This eliminates the need to import namespaces
although you still need to to specify the package in the DESCRIPTION file
"Imports:" section.

Best,

Jon

On Mon, Jun 29, 2015 at 8:46 AM, Uwe Ligges  wrote:

>
>
> On 29.06.2015 11:10, Daniel Lüdecke wrote:
>
>> Hello,
>>
>> I'm doing my package check for CRAN, in order to see whether submitting
>> the
>> package-update passes all checks.
>> I'm doing the tests under Windows 7, using R-Version "R Under development
>> (unstable) (2015-06-28 r68602)".
>>
>> Now I got a quite long list of NOTEs, which are probably no problem,
>> however, I would like to fix these issues, if possible.
>>
>> It seems that all base and/or stats function now produce a note concering
>> the visible global function definition. Here's a short example of my
>> output
>> from my package check:
>>
>> sjp.grpfrq: no visible global function definition for 'sd'
>> sjp.grpfrq: no visible global function definition for 'plot'
>> sjp.int: no visible global function definition for 'sd'
>> sjp.int: no visible global function definition for 'quantile'
>> sjp.int: no visible global function definition for 'plogis'
>> sjp.likert: no visible global function definition for 'xtabs'
>> sjp.likert: no visible binding for global variable 'offset'
>> sjp.likert: no visible global function definition for 'plot'
>> sjp.lm: no visible global function definition for 'coef'
>> sjp.lm: no visible global function definition for 'coefficients'
>> sjp.lm: no visible global function definition for 'confint'
>> sjp.lm.eff: no visible global function definition for 'model.matrix'
>>
>> Do I have to import all these namespaces now? I'm using RStudio with
>> roxygen, so I would add an @importFrom stats  where
>> necessary
>> - but is this the new requirement as of R >= 3.3?
>>
>
> Yes. And it should have been a requirement before, I believe.
>
> Best,
> Uwe Ligges
>
>
>
>
>> Best wishes
>> Daniel
>>
>>
>>
>>
>> --
>>
>> _
>>
>> Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen
>> Rechts; Gerichtsstand: Hamburg | www.uke.de
>> Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr.
>> Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
>> _
>>
>> SAVE PAPER - THINK BEFORE PRINTING
>>
>> __
>> R-package-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
>>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>



-- 
Jonathan Callahan, PhD
Mazama Science
206-708-5028
mazamascience.com

[[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] no visible global function definition

2015-06-29 Thread Hadley Wickham
> and available as an RSS feed.  (If you prefer Twitter, feel free to
> mirror the RSS feed there, if that's possible.  I don't use Twitter, so
> I won't do it.)  It seems to have become known here essentially
> immediately, so I'm not sure how an announcement would help.
>
> For the reasoning:  there's been a general trend to making sure packages
> work even when other packages don't use library() or require() to attach
> them.  This is a logical step in that direction.  If your function foo()
> uses the graphics plot() function but doesn't explicitly import it, then
> your function will fail if a user tries to run it while graphics isn't
> attached.  I suspect dispatch may also be faster if it is imported than
> if R has to search through everything on the search list.

Or it will fail in unexpected ways if the user has defined their own
plot method in the global environment.  This new check is an important
one to make sure you code works as expected, regardless of what else
is on the search path.

Hadley

-- 
http://had.co.nz/

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] appropriate directory for data downloads in examples, demos and vignettes

2015-06-29 Thread Jonathan Callahan
Henrik,

Thanks for the detailed response! I'll have to look at the R.cache package
and try out your suggestions.

Jon

On Mon, Jun 29, 2015 at 12:48 PM, Henrik Bengtsson <
henrik.bengts...@ucsf.edu> wrote:

> FYI,
>
> my R.cache package keeps cache files under a specific cache directory.
> To meet the CRAN Policies
> [http://cran.r-project.org/web/packages/policies.html] that:
>
> "Packages should not write in the users’ home filespace, nor anywhere
> else on the file system apart from the R session’s temporary directory
> (or during installation in the location pointed to by TMPDIR: and such
> usage should be cleaned up). Installing into the system’s R
> installation (e.g., scripts to its bin directory) is not allowed.
>
> Limited exceptions may be allowed in interactive sessions if the
> package obtains confirmation from the user."
>
> The R.cache root directory is setup as follows:
>
> 1. It can be specified via environment variable R_CACHE_PATH.  If that
> is not given, it defaults to ~/.Rcache/, i.e. effectively: rootpath <-
> Sys.getenv("R_CACHE_PATH", default="~/.Rcache").
>
> 2. Next, if and only if this directory exists, then no "questions
> asked" and this directory will be used as is.
>
> 3. If it does not exist and R runs in an interactive session, then the
> user is prompted whether s/he wish to create the directory given by
> the 'rootpath' rule above, e.g.
>
> > library(R.cache)
> The R.cache package needs to create a directory that will hold cache
> files. It is convenient to use one in the user's home directory,
> because it remains also after restarting R. Do you wish to create the
> '~/.Rcache/' directory? If not, a temporary directory
> (C:\Users\hb\AppData\Local\Temp\Rtmp0udmsF/.Rcache) that is specific
> to this R session will be used. [Y/n]:
>
> If user accepts, then the directory is created and we're back to Step
> 2 above (which will be the case for all future R sessions).
>
> 4. If the user don't want to create this directory, or R runs in a
> non-interactive session (e.g. R CMD check), then a temporary cache
> directory is used, which is rootpath <- file.path(tempdir(),
> ".Rcache").  This directory is only guaranteed to exist for the
> current session.
>
> Comment on ~/.Rcache/: This default was chosen because it can be
> created on all platforms and for all users.  I don't know of any other
> path (except one under tempdir()) for which this is true.  The
> downside is that it adds to the user's quota, will most likely be
> backed up by default etc. However, it is very easy to use file links
> to point it elsewhere, e.g. ln -s /vartmp/$USER/.Rcache ~/.Rcache/.
>
>
> If your GIS data is supposed to live beyond a single R session, then
> you could use a similar approach for your MazamaSpatialUtils package.
> You could emulate the above completely, e.g. MAZAMA_SPATIAL_PATH and
> ~/.mazama_spatial/.  Alternatively, you could leverage the R.cache
> package and simply put all your data in a subdirectory under the
> R.cache root path, e.g. getCachePath(dirs="MazamaSpatialUtils").  For
> most users this will become ~/.Rcache/MazamaSpatialUtils/.  With this,
> all required interactions with the user is taken care of by R.cache
> (as above) and it will also fallback to using a temporary directory
> when run under 'R CMD check'.k
>
>
> Either way, you definitely want to use tempdir() for a
> session-specific temporary directory, e.g.
>
> > tempdir()
> [1] "C:\\Users\\hb\\AppData\\Local\\Temp\\Rtmp0udmsF"
>
> It works on all platforms and you don't have to create your on "hash"
> subdirectory.
>
>
> /Henrik
> (author of R.cache)
>
> On Mon, Jun 29, 2015 at 9:22 AM, Paul Gilbert 
> wrote:
> > Regarding alternative places for scripts, you can add a directory (eg
> > inst/testLocalScripts) and then with a recently added R CMD feature you
> can
> > do
> >
> >  R CMD check --test-dir=inst/testLocalScripts your-package.tar.gz
> >
> > This will not (automatically) be checked on CRAN. Beware that you also
> need
> > to run R CMD check without this option to run your regular tests.
> >
> > Paul
> >
> >
> >
> > On 06/29/2015 11:25 AM, Jonathan Callahan wrote:
> >>
> >> Hi,
> >>
> >> The MazamaSpatialUtils
> >>  package has a
> >> required "package state" variable which users set to specify where they
> >> want to store large amounts of GIS data that is being downloaded and
> >> converted by the package. The implementation of this follows Hadley's
> >> advice here:
> >>
> >> http://adv-r.had.co.nz/Environments.html#explicit-envs
> >>
> >> The functionality is implemented with package environment and getter and
> >> setter functions:
> >>
> >> spatialEnv <- new.env(parent = emptyenv())
> >> spatialEnv$dataDir <- NULL
> >>
> >>
> >> getSpatialDataDir <- function() {
> >>if (is.null(spatialEnv$dataDir)) {
> >>  stop('No data directory found. Please set a data directory with
> >> setSpatialDataDir("YOUR_DATA_DIR").',call.=FALSE)
> >>} else

Re: [R-pkg-devel] no visible global function definition

2015-06-29 Thread Dirk Eddelbuettel

On 29 June 2015 at 10:23, Neal Fultz wrote:
| There's https://twitter.com/cranpolicywatch
| 
| I wouldn't mind if that got forwarded to r-package-devel, as I'm not on
| twitter myself.

CRAN Policy Watch is a simple-ish cronjob and you can also 'watch' (or
subscribe to) the underlying GitHub repo at

   https://github.com/eddelbuettel/crp

A much better way (for R NEWS) is the 'R Devel Changes' RSS feed Duncan set
up (and mentioned):

   http://developer.r-project.org/blosxom.cgi/R-devel

I read this via the Feedly RSS every day (as it posts only daily).  Together
with CRANberries (for packages), these three provide good coverage.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] no visible global function definition

2015-06-29 Thread Uwe Ligges
Most of this has been answered by others already. Note that package base 
itself is always imported into the Namespace but names from the other 
packages are not and really need to be if actually used.


Best,
Uwe Ligges

On 29.06.2015 19:09, Kevin Ushey wrote:

Hi Uwe,

It seems like this is quite a major change; I imagine it will affect
many packages (since lots of packages implicitly assume other 'base'
packages, like 'utils', will always be available in an R session). IIUC,
in the latest versions of R-devel, only the 'base' package can be
assumed available; everything else must be explicitly imported.

https://github.com/wch/r-source/commit/dba5a49dcae7e9bcb8528cf78fd9d51f092652b2

Is there any chance that such changes could be made in announcements on
R-pkg-devel? Or, as an aside, would it be permissible for non-R-core
members to make such announcements on this list?

Thanks,
Kevin

On Mon, Jun 29, 2015 at 8:46 AM, Uwe Ligges
mailto:lig...@statistik.tu-dortmund.de>> wrote:



On 29.06.2015 11:10, Daniel Lüdecke wrote:

Hello,

I'm doing my package check for CRAN, in order to see whether
submitting the
package-update passes all checks.
I'm doing the tests under Windows 7, using R-Version "R Under
development
(unstable) (2015-06-28 r68602)".

Now I got a quite long list of NOTEs, which are probably no problem,
however, I would like to fix these issues, if possible.

It seems that all base and/or stats function now produce a note
concering
the visible global function definition. Here's a short example
of my output
from my package check:

sjp.grpfrq: no visible global function definition for 'sd'
sjp.grpfrq: no visible global function definition for 'plot'
sjp.int : no visible global function definition
for 'sd'
sjp.int : no visible global function definition
for 'quantile'
sjp.int : no visible global function definition
for 'plogis'
sjp.likert: no visible global function definition for 'xtabs'
sjp.likert: no visible binding for global variable 'offset'
sjp.likert: no visible global function definition for 'plot'
sjp.lm: no visible global function definition for 'coef'
sjp.lm: no visible global function definition for 'coefficients'
sjp.lm: no visible global function definition for 'confint'
sjp.lm.eff: no visible global function definition for 'model.matrix'

Do I have to import all these namespaces now? I'm using RStudio with
roxygen, so I would add an @importFrom stats 
where necessary
- but is this the new requirement as of R >= 3.3?


Yes. And it should have been a requirement before, I believe.

Best,
Uwe Ligges




Best wishes
Daniel




--

_

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des
öffentlichen Rechts; Gerichtsstand: Hamburg | www.uke.de

Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender),
Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
_

SAVE PAPER - THINK BEFORE PRINTING

__
R-package-devel@r-project.org
 mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


__
R-package-devel@r-project.org 
mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel




__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] no visible global function definition

2015-06-29 Thread Uwe Ligges



On 29.06.2015 19:19, Zhian Kamvar wrote:

Does this also mean that we now need to include these packages (stats, 
graphics, etc) in the Imports field of the DESCRIPTION?


Yes. And by proper import directives in the NAMESPACE file, ideally you 
should be selectively importing via importFrom() directives.


Best,
Uwe Ligges



Thanks,
Zhian

On Jun 29, 2015, at 10:09 , Kevin Ushey  wrote:

Hi Uwe,

It seems like this is quite a major change; I imagine it will affect many
packages (since lots of packages implicitly assume other 'base' packages,
like 'utils', will always be available in an R session). IIUC, in the
latest versions of R-devel, only the 'base' package can be assumed
available; everything else must be explicitly imported.

https://github.com/wch/r-source/commit/dba5a49dcae7e9bcb8528cf78fd9d51f092652b2

Is there any chance that such changes could be made in announcements on
R-pkg-devel? Or, as an aside, would it be permissible for non-R-core
members to make such announcements on this list?

Thanks,
Kevin

On Mon, Jun 29, 2015 at 8:46 AM, Uwe Ligges 
wrote:





On 29.06.2015 11:10, Daniel Lüdecke wrote:


Hello,

I'm doing my package check for CRAN, in order to see whether submitting
the
package-update passes all checks.
I'm doing the tests under Windows 7, using R-Version "R Under development
(unstable) (2015-06-28 r68602)".

Now I got a quite long list of NOTEs, which are probably no problem,
however, I would like to fix these issues, if possible.

It seems that all base and/or stats function now produce a note concering
the visible global function definition. Here's a short example of my
output
from my package check:

sjp.grpfrq: no visible global function definition for 'sd'
sjp.grpfrq: no visible global function definition for 'plot'
sjp.int: no visible global function definition for 'sd'
sjp.int: no visible global function definition for 'quantile'
sjp.int: no visible global function definition for 'plogis'
sjp.likert: no visible global function definition for 'xtabs'
sjp.likert: no visible binding for global variable 'offset'
sjp.likert: no visible global function definition for 'plot'
sjp.lm: no visible global function definition for 'coef'
sjp.lm: no visible global function definition for 'coefficients'
sjp.lm: no visible global function definition for 'confint'
sjp.lm.eff: no visible global function definition for 'model.matrix'

Do I have to import all these namespaces now? I'm using RStudio with
roxygen, so I would add an @importFrom stats  where
necessary
- but is this the new requirement as of R >= 3.3?



Yes. And it should have been a requirement before, I believe.

Best,
Uwe Ligges





Best wishes
Daniel




--

_

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen
Rechts; Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr.
Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
_

SAVE PAPER - THINK BEFORE PRINTING

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



__
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




__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel