Search code examples
rpackagerstudiowarnings

R CMD check A complete check needs the 'checkbashisms' script


I am in the very early stages of writing a package using RStudio. The basic package structure was created using William Landau's instantiate package. When I click on the Check button all appears to go well but I get two warnings, one of which reads in full:

checking top-level files ... WARNING A complete check needs the 'checkbashisms' script. See section ‘Configure and cleanup’ in the ‘Writing R Extensions’ manual.

(The other warning is about something else entirely).

I have seen this answer: [https://stackoverflow.com/questions/63698128/r-package-check-warning-a-complete-check-needs-the-checkbashisms-script] but still do not understand what to do. I do not know what $PATH is, or how to add something to it.

I also saw this answer: [ https://stat.ethz.ch/pipermail/r-package-devel/2020q3/005877.html][1]

In consequence I added _R_CHECK_BASHISMS_ = FALSE to my .Renviron file but that had no effect.

What do I have to do to remove this warning?


Solution

  • The R check code wants the configure and cleanup scripts to be written without relying on the bash shell, because it isn't available on all systems where your package might be installed.

    It uses a script called checkbashisms to look at those files to confirm they are written portably. However, checkbashisms isn't included in R, it's assumed to be available on your system. So you get the warning you saw if you have configure or cleanup scripts, but R can't find checkbashisms.

    This means there are a couple of ways to stop the message. You could install checkbashisms in a place where R will find it. It uses the PATH environment variable to search for external programs, so you would need to make sure checkbashisms was installed in one of the directories listed in it. (You can see that environment variable using Sys.getenv("PATH") from within R.)

    Another way is to make sure your package doesn't include configure or cleanup scripts. Those are only needed for packages that are doing complicated things, often using external libraries. You mentioned in a comment that the automatically generated scripts were looking for Stan models. That might mean you need those scripts.

    However, unless you're writing at a fairly low level, it's probably enough for your package to depend on another package that uses Stan, e.g. RStan. Then if Stan can't be found, that other package will fail to load, and your package will also fail to load. Then you can delete configure and cleanup and won't need to install checkbashisms.

    You could also just ignore the message. CRAN will have checkbashisms installed, so they won't get that message and won't block your package because of it.