Brad McNeney
2012-Apr-06 18:46 UTC
[Rd] R CMD check returns NOTE about package data set as global variable
I'm developing a package that comes with a data set called RutgersMapB36. One of the package's functions requires this data frame. A toy example is: test<-function() { data(RutgersMapB36) return(RutgersMapB36[,1]) } R CMD check returns a NOTE: test: no visible binding for global variable 'RutgersMapB36' Is there any way to avoid this NOTE? Thanks, Brad --- Brad McNeney Statistics and Actuarial Science Simon Fraser University
Prof Brian Ripley
2012-Apr-06 19:18 UTC
[Rd] R CMD check returns NOTE about package data set as global variable
On 06/04/2012 19:46, Brad McNeney wrote:> I'm developing a package that comes with a data set called RutgersMapB36. One of the package's functions requires this data frame. A toy example is: > > test<-function() { > data(RutgersMapB36) > return(RutgersMapB36[,1]) > } > > > R CMD check returns a NOTE: > > test: no visible binding for global variable 'RutgersMapB36' > > Is there any way to avoid this NOTE?Use data("RutgersMapB36"), which many think is good practice in code.> > Thanks, > > Brad > --- > Brad McNeney > Statistics and Actuarial Science > Simon Fraser University > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Hadley Wickham
2012-Apr-06 19:38 UTC
[Rd] R CMD check returns NOTE about package data set as global variable
Is the dataset something that package users will need, or just your package's functions? Hadley On Fri, Apr 6, 2012 at 1:46 PM, Brad McNeney <mcneney at sfu.ca> wrote:> I'm developing a package that comes with a data set called RutgersMapB36. One of the package's functions requires this data frame. A toy example is: > > test<-function() { > ?data(RutgersMapB36) > ?return(RutgersMapB36[,1]) > } > > > R CMD check returns a NOTE: > > test: no visible binding for global variable 'RutgersMapB36' > > Is there any way to avoid this NOTE? > > Thanks, > > Brad > --- > Brad McNeney > Statistics and Actuarial Science > Simon Fraser University > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel-- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/