Dear Glenn, Suppose this function
test <- function(df){ ggplot(df, aes(x = gp, y = y)) + geom_point() } Then R CMD check will consider gp and y as global variables since they are undefined. Because R CMD check cannot detect that gp and y will be extracted from df by ggplot2. Possible workarounds # now gp and y are defined within the function. ggplot2 still looks for gp and y in df. test <- function(df){ gp <- NULL y <- NULL ggplot(df, aes(x = gp, y = y)) + geom_point() } # now "gp" and "y" are strings and hence defined test <- function(df){ ggplot(df, aes_string(x = "gp", y = "y")) + geom_point() } Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-05-26 2:24 GMT+02:00 Glenn Schultz <glennmschu...@me.com>: > Hello All, > > I have two packages Bond Lab and the Companion to Investing in MBS. Bond > Lab clears the check and I am working on the on.load() to copy a needed > directory per Duncan Murdoch's advise to make Bond Lab CRAN-able. The > companion passes with two notes. The output is below: > > I get two notes (highlighted in red) > > Not sure on this one as I tried to declare methods but I get another note > methods declared but not used. The second note is related to ggplot2 they > are variable passed to ggplot2 within a function. I am not sure why they > appear in the R CMD check. If someone could point in the right direction > to resolve these I would appreciate the advice. These are my last > remaining two issues to make the packages pass CRAN aside from the on.load() > > Best Regards, > Glenn > > * checking dependencies in R code ... NOTE > package ‘methods’ is used but not declared > > > * checking R code for possible problems ... NOTE > CreditEnhancement: no visible binding for global variable ‘Period’ > CreditEnhancement: no visible binding for global variable ‘Value’ > CreditEnhancement: no visible binding for global variable ‘Variable’ > CreditEnhancement: no visible binding for global variable ‘..density..’ > PassThrough.OAS: no visible binding for global variable ‘value’ > PassThrough.OAS: no visible binding for global variable ‘..density..’ > PassThroughCashFlow: no visible binding for global variable ‘Period’ > PassThroughCashFlow: no visible binding for global variable ‘value’ > PassThroughCashFlow: no visible binding for global variable ‘variable’ > PlotMtgKeyRates: no visible binding for global variable ‘Tenor’ > PlotMtgKeyRates: no visible binding for global variable ‘Duration’ > PlotTermStructure: no visible binding for global variable ‘value’ > PlotTermStructure: no visible binding for global variable ‘variable’ > REMICOAS: no visible binding for global variable ‘value’ > REMICOAS: no visible binding for global variable ‘..density..’ > TotalReturn: no visible binding for global variable ‘Scenario’ > TotalReturn: no visible binding for global variable ‘value’ > TotalReturn: no visible binding for global variable ‘variable’ > TwistScenario: no visible binding for global variable ‘Scenario’ > TwistScenario: no visible binding for global variable ‘Return’ > ValuationFramework: no visible binding for global variable ‘value’ > ValuationFramework: no visible binding for global variable ‘variable’ > > ==> devtools::check() > > Updating Companion2IMBS documentation > Loading Companion2IMBS > '/Library/Frameworks/R.framework/Resources/bin/R' --vanilla CMD build \ > '/Users/glennschultz/Companion to Investing in MBS' --no-resave-data \ > --no-manual > > * checking for file ‘/Users/glennschultz/Companion to Investing in > MBS/DESCRIPTION’ ... OK > * preparing ‘Companion2IMBS’: > * checking DESCRIPTION meta-information ... OK > * checking for LF line-endings in source and make files > * checking for empty or unneeded directories > Removed empty directory ‘Companion2IMBS/inst’ > Removed empty directory ‘Companion2IMBS/test/testthat’ > Removed empty directory ‘Companion2IMBS/test’ > * building ‘Companion2IMBS_1.0.tar.gz’ > > '/Library/Frameworks/R.framework/Resources/bin/R' --vanilla CMD check \ > > '/var/folders/tv/sq6gmnvs13j8jrhkt87f_zmc0000gn/T//RtmpOabREs/Companion2IMBS_1.0.tar.gz' > \ > --timings > > * using log directory ‘/Users/glennschultz/Companion2IMBS.Rcheck’ > * using R version 3.0.3 (2014-03-06) > * using platform: x86_64-apple-darwin10.8.0 (64-bit) > * using session charset: UTF-8 > * checking for file ‘Companion2IMBS/DESCRIPTION’ ... OK > * checking extension type ... Package > * this is package ‘Companion2IMBS’ version ‘1.0’ > * checking package namespace information ... OK > * checking package dependencies ... OK > * checking if this is a source package ... OK > * checking if there is a namespace ... OK > * checking for executable files ... OK > * checking for hidden files and directories ... OK > * checking for portable file names ... OK > * checking for sufficient/correct file permissions ... OK > * checking whether package ‘Companion2IMBS’ can be installed ... OK > * checking installed package size ... OK > * checking package directory ... OK > * checking DESCRIPTION meta-information ... OK > * checking top-level files ... OK > * checking for left-over files ... OK > * checking index information ... OK > * checking package subdirectories ... OK > * checking R files for non-ASCII characters ... OK > * checking R files for syntax errors ... OK > * checking whether the package can be loaded ... OK > * checking whether the package can be loaded with stated dependencies ... > OK > * checking whether the package can be unloaded cleanly ... OK > * checking whether the namespace can be loaded with stated dependencies > ... OK > * checking whether the namespace can be unloaded cleanly ... OK > * checking dependencies in R code ... NOTE > package ‘methods’ is used but not declared > See the information on DESCRIPTION files in the chapter ‘Creating R > packages’ of the ‘Writing R Extensions’ manual. > * checking S3 generic/method consistency ... OK > * checking replacement functions ... OK > * checking foreign function calls ... OK > * checking R code for possible problems ... NOTE > CreditEnhancement: no visible binding for global variable ‘Period’ > CreditEnhancement: no visible binding for global variable ‘Value’ > CreditEnhancement: no visible binding for global variable ‘Variable’ > CreditEnhancement: no visible binding for global variable ‘..density..’ > PassThrough.OAS: no visible binding for global variable ‘value’ > PassThrough.OAS: no visible binding for global variable ‘..density..’ > PassThroughCashFlow: no visible binding for global variable ‘Period’ > PassThroughCashFlow: no visible binding for global variable ‘value’ > PassThroughCashFlow: no visible binding for global variable ‘variable’ > PlotMtgKeyRates: no visible binding for global variable ‘Tenor’ > PlotMtgKeyRates: no visible binding for global variable ‘Duration’ > PlotTermStructure: no visible binding for global variable ‘value’ > PlotTermStructure: no visible binding for global variable ‘variable’ > REMICOAS: no visible binding for global variable ‘value’ > REMICOAS: no visible binding for global variable ‘..density..’ > TotalReturn: no visible binding for global variable ‘Scenario’ > TotalReturn: no visible binding for global variable ‘value’ > TotalReturn: no visible binding for global variable ‘variable’ > TwistScenario: no visible binding for global variable ‘Scenario’ > TwistScenario: no visible binding for global variable ‘Return’ > ValuationFramework: no visible binding for global variable ‘value’ > ValuationFramework: no visible binding for global variable ‘variable’ > * checking Rd files ... OK > * checking Rd metadata ... OK > * checking Rd line widths ... OK > * checking Rd cross-references ... OK > * checking for missing documentation entries ... OK > * checking for code/documentation mismatches ... OK > * checking Rd \usage sections ... OK > * checking Rd contents ... OK > * checking for unstated dependencies in examples ... OK > * checking examples ... [60s/60s] OK > Examples with CPU or elapsed time > 5s > user system elapsed > TwistScenario 18.827 1.037 19.872 > PassThrough.OAS 17.485 0.068 17.567 > CreditEnhancement 10.959 0.128 11.106 > PlotMtgKeyRates 10.081 0.421 10.506 > * checking PDF version of manual ... OK > NOTE: There were 2 notes. > See > ‘/Users/glennschultz/Companion2IMBS.Rcheck/00check.log’ > for details. > > > > R CMD check succeeded > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.