Hello
I am trying to build a package to upload it to Bioconductor-
The package builds correctly using R-2.6.2 and Bioconductor 2.1 but R CMD check
issues the following warning:
--------------------------------------------------------------
* checking for unstated dependencies in R code ... WARNING
'library' or 'require' calls not declared from:
anotPkg anotPack
See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.
---------------------------------------------------------------
'anotPkg' or 'anotPack' are not package names indeed. I use them as argument
to pass any annotation package names to a function which will load them in
execution time.
It is as if I wanted to have a 'loadAnnotations' function in my package which
could be as follows:
loadAnnotations <- function (anotPack){
if (!require(anotPack, character.only=T))
cat("Could not load the package")
}
So my question is: what should I do if I wanted to include such a function in my
package to avoid the warning?
Thanks for any suggestions
Alex Sanchez
Departament d'Estadistica. Universitat de Barcelona
[Bioc-devel] warning in R CMD check
3 messages · ALEXANDRE SANCHEZ PLA, Joern Toedling
Hi Alex, use the function's argument 'quietly' to suppress the warning. require(anotPack, character.only=TRUE, quietly=TRUE) btw, I would suggest to spell out TRUE in functions, since some users might unwisely have used 'T' as a variable name. Regards, Joern
ALEXANDRE SANCHEZ PLA wrote:
Hello
I am trying to build a package to upload it to Bioconductor-
The package builds correctly using R-2.6.2 and Bioconductor 2.1 but R CMD check
issues the following warning:
--------------------------------------------------------------
* checking for unstated dependencies in R code ... WARNING
'library' or 'require' calls not declared from:
anotPkg anotPack
See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.
---------------------------------------------------------------
'anotPkg' or 'anotPack' are not package names indeed. I use them as argument
to pass any annotation package names to a function which will load them in
execution time.
It is as if I wanted to have a 'loadAnnotations' function in my package which
could be as follows:
loadAnnotations <- function (anotPack){
if (!require(anotPack, character.only=T))
cat("Could not load the package")
}
So my question is: what should I do if I wanted to include such a function in my
package to avoid the warning?
Thanks for any suggestions
Alex Sanchez
Departament d'Estadistica. Universitat de Barcelona
Actually the remark about spelling out TRUE instead of T is even more relevant to your question than I thought. You may want to use 'quietly', but the reason for your warning in check is really the 'T'. Put character.only=TRUE and the warning should be gone.
Joern Toedling wrote:
Hi Alex, use the function's argument 'quietly' to suppress the warning. require(anotPack, character.only=TRUE, quietly=TRUE) btw, I would suggest to spell out TRUE in functions, since some users might unwisely have used 'T' as a variable name. Regards, Joern ALEXANDRE SANCHEZ PLA wrote:
Hello
I am trying to build a package to upload it to Bioconductor-
The package builds correctly using R-2.6.2 and Bioconductor 2.1 but R CMD check
issues the following warning:
--------------------------------------------------------------
* checking for unstated dependencies in R code ... WARNING
'library' or 'require' calls not declared from:
anotPkg anotPack
See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.
---------------------------------------------------------------
'anotPkg' or 'anotPack' are not package names indeed. I use them as argument
to pass any annotation package names to a function which will load them in
execution time.
It is as if I wanted to have a 'loadAnnotations' function in my package which
could be as follows:
loadAnnotations <- function (anotPack){
if (!require(anotPack, character.only=T))
cat("Could not load the package")
}
So my question is: what should I do if I wanted to include such a function in my
package to avoid the warning?
Thanks for any suggestions
Alex Sanchez
Departament d'Estadistica. Universitat de Barcelona