Search code examples
rknitrdevtoolsr-package

Non-standard file/directory found at top level: 'README.Rmd' persists even after implementing suggested solutions


I am working on a package and running R CMD CHECK on it using devtools::check() produces the following NOTE:

> checking top-level files ... NOTE
  Non-standard file/directory found at top level:
    'README.Rmd'

A variant of this question has been raised before (NOTE or WARNING from package check when README.md includes images), but that solution provided therein hasn't worked for me.

Here is my .Rbuildignore file. As has been suggested, I have included ^README-.*\.png$:

^.*\.Rproj$
^\.Rproj\.user$
^CONDUCT\.md$
^\.travis\.yml$
^README-.*\.png$
^cran-comments\.md$

Additionally, my README.Rmd document has the following chunk, which saves all figures in /man/figures/

{r, echo = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)

If you need more details about the .Rmd file, it's here: https://github.com/IndrajeetPatil/ggstatsplot/blob/master/README.Rmd

Given that it's better to get rid of all possible NOTES to successfully pass CRAN's R CMD CHECK, how can I avoid this particular NOTE?


Solution

  • To exclude the file README.Rmd from the tarball created by R, add

    ^README.Rmd
    

    to the file .Rbuildignore you already have. "Writing R Extensions" has more, should you need it.