devtools::check() creating warning that only contains NULL - r

I'm currently doing some work on a package, and calling devtools::check() is producing the following warning:
❯ checking Rd files ... WARNING
NULL
However, when manually inspecting each of the .Rd files created by devtools::document() and re-reading the documentation, I don't see why this warning is appearing. I know it's only a warning and doesn't impact the functionality of the package, but I can't figure out where this is coming from.
Any help is greatly appreciated.

This rig-related bug has been fixed with version 0.5.2, see r-lib/rcmdcheck#184 on GitHub. #rossdrucker9 I am well aware that you already know about this.. just want to write it down for future generations that end up here first (like I did).

Related

R: Error in as.environment(pos) / Error during wrapup: no item called "package:[package]" on the search list

This is similar to this but with a followup question:
I'm preparing my package for submission to CRAN. In one script, it gives the titular error:
Error in as.environment(pos): no item called "package:shapefiles" on the search list
or
Error during wrapup: no item called "package:shapefiles" on the search list
If, like the similar thread linked above, I add
attachNamespace("shapefiles")
Then I no longer get that error, but instead I sometimes get the error or warning:
namespace(shapefiles) was already taken
I believe this happens if the function/script is run more than once. What's so weird about this to me is that
#' #import shapefiles
is in that script's markdown block,
Which means
import(shapefiles)
is in NAMESPACE, and
Imports:
shapefiles (>= 0.7),
is in DESCRIPTION. I have numerous other package dependencies which are imported the same way (correctly, I believe), and none of them produce this error. I don't see why this is behaving differently therefore, and would like to avoid having either issue before submitting to CRAN. The code that calls this package, in my script, is
shapefiles::read.shapefile(savename)
Script is here, for reference.
Thanks in advance for any ideas!
Edit: steps to reproduce:
setwd("/folder")
library(devtools)
install_github("SimonDedman/gbm.auto")
library(gbm.auto)
gbm.basemap(bounds = c(-81.7, -80.3, 24.7, 25.9),
savedir = "/folder")
I've just removed shapefiles:: from the code. The correct output is produced regardless.
Problem resolved itself after commenting out attachNamespace("shapefiles"). No idea why.

R package check() warning: A complete check needs the 'checkbashisms' script

Today I have tried to prepare a new CRAN update for a package and have come across a warning, while performing devtools::check().
Since this warning also occurs without my changes I made to the package, I am assuming this is a new check. Unfortunately I don't really get what I am supposed to do.
This is the error message:
A complete check needs the 'checkbashisms' script.
See section ‘Configure and cleanup’ in the ‘Writing R Extensions’
manual.
Of course I took a look at the section ‘Configure and cleanup’ as proposed in the warning. But still, I am not sure what to do exactly. I got, there is a checkbashisms Perl script I can download somewhere on the internet (but this alone won't make this message disappear). How shall I integrate this, that the message actually disappears.
Any hints or comments would be extremely helpful to me.
Here is a link to the repo of the package in case you want to clone it to reproduce the error.

\code{\link{function-name}} in roxygen2

It is my first experience in writing an R-package. I used roxygen2 by following the instructions given in this link http://kbroman.org/pkg_primer/
Everythig is working fine except few things.. there could be a simpler solution to solve the issues, but I am not finding clues what I am doing wrong. I hope someone here in this blog can give a solution to solve my issues.
First issue is about {\code\link{function-name}} in roxygen2:
In .R script I inlcuded this line:
#' #seealso \code{\link{s2a}}
After documenting (generating .Rd files) there is no hyperlink to s2a ,
in documentation s2a shows like a normal text not like hyperlink..
export(s2a) is listed out in NAMESPACE.
Is there any other place i need to modify ?
Second issue is about data():
I saved the dataset in .Rdata format and placed in the data/ in package directory. I also created the .R script in R/ as like following steps here http://kbroman.org/pkg_primer/pages/data.html
In DESCRIPTION file LazyData: true .
but when I type data(shh) in R console gives a warning message
data(shh)
Warning message:
In data(shh) : data set ‘shh’ not found
Any ideas is of great help:)
It's been a while since you asked this, but I was having the exact same problem with hyperlinks in documentation not appearing correctly, so for anyone who might be having a similar problem: Are you possibly viewing the development documentation? The links don't seem to work there. (You'll know this is the case if you see Using development documentation for your_function_name in your console output when you run ?your_function_name.)
The links should appear in the non-development documentation. To generate this you can try building and reloading your package, for instance by following the steps here: http://r-pkgs.had.co.nz/man.html#man-workflow-2

Package development: run_examples could not find function

I'm developing an R package, pk, say. I've successfully installed it and used it, and now I'm trying to clean up the examples with the help of the run_examples function in the devtools package. However, it crashes on the very first example:
> require(pk)
> require(devtools)
> run_examples("~/[full path]/pk")
Updating pk documentation
Running 45 example files in pk
--------------------------------------------------------------------------------
Loading pk
Running examples in pk-package.Rd
--------------------------------------------------------------------------------
1> ########################################################################
1> ## Simulate a dataset ... blah blah
1> set.seed(1)
1> x = my_pk_fun(a = 1)
Error in eval(expr, envir, enclos) : could not find function "my_pk_fun"
Loading pk
As I already loaded my package (using require), what more do I have to do to make my_pk_fun visible to run_examples? I've checked that my_pk_fun is indeed present in my R session.
UPDATE:
Following the comment by Dirk, I examined my namespace file, and found it to be completely empty. As suggested (though not recommended) by the documentation, I inserted exportPattern("^[^\\.]"), which, it seems, is supposed to export all of the functions, including my_pk_fun. However, upon repeating the experiment above, (a) I get the same error, and (b) the contents of the namespace file are deleted! Why does run_examples empty my namespace file?
I conjecture a resolution of my own question:
One detail that I omitted is that before I could get run_examples to do anything at all, it required me to first install the roxygen2 package (even though roxygen2 is listed only under "suggests" in the devtools documentation!).
When digging through the source code of run_examples, I did indeed find some use of roxygenize. It has been previously noted that roxygenizing a package can have the effect of rewriting the NAMESPACE file.
To be explicit, the reason that run_examples empties my NAMESPACE file is that (1) run_examples roxygenized my package while (2) I never included any # #export command (or any other roxygen2-speak, for that matter) in my source files.
Conclusion: Unless you are building your package within the roxygen2 framework, and including all of your .Rd documentation as comments in your source code, then do not use run_examples! It seems like there should be a warning about this in the run_examples documentation.
A way out: If you really must use run_examples, and you're willing to learn a little bit about roxygen, which is actually pretty cool, then start here.

RcmdrPluginPackage Paths

My paths and files are as follows ...
E:R/R-2.15.1/library/Rcmdr/
E:R/R-2.15.1/library/RcmdrPlugin.Package/
E:R/R-2.15.1/MyLibrary/RcmdrPlugin.Package.zip
E:R/R-2.15.1/MyLibrary/RcmdrPlugin.Package/
where, in the name RcmdrPlugin.Package, I've used the word 'Package' to represent the name of the actual package being used.
The installation is as described above because (i) I'm not an expert at installing packages, (ii) I couldn't do a direct install from Cran because I wanted to put the package onto a USB stick; and, (iii) at work the Cran server is blocked (sic).
When I start the package from the GUI the Cmdr opens once and quickly closes (I don't know if this is relevant or normal) and opens again. Once open, I can operate the package via the Cmdr interface. It's a very nice package, everything works really well until I want to save the work. Then I get the following error,
Error in obj[i] : object of type 'closure' is not subsettable
I've been in contact with the people who developed (and are still developing) the package and they cannot reproduce the bug.
I strongly suspect that the problem lies in my 'crappy' install and file configuration, rather than with the package.
Can anyone please help me by suggesting how I would undo what I've done and do it properly in view of the constraints list above?
I appreciate that I can use Remove to get rid of the package but I don't want to start tinkering with something without having a greater understanding of what I'm doing.
Lastly, note that is error has been discussed a number of times on this list but not within this particular context.
I've managed to get it to work by following the instructions from here stackoverflow.com/questions/12820189/… where I set repos=NULL after I'd put the package into /MyLibrary/

Resources