Pkgdown: Ghost inst/doc folder

Created on 14 Mar 2018  Â·  12Comments  Â·  Source: r-lib/pkgdown

Hi there,

I'm getting a warning about files in the subdirectory inst/doc when I build vignettes, even though I don't see the inst/doc folder on either my github branch or local repo:

creating vignettes ...checking package subdirectories ... WARNING
Subdirectory 'inst/doc' contains invalid file names:
  ‘01_datateam.Rmd’ ‘02_pi.Rmd’ ‘03_datadev.Rmd’ ‘01_datateam.html’
  ‘02_pi.html’ ‘03_datadev.html’

Adding vignettes to .Rbuildignore fixes it (see https://travis-ci.org/NCEAS/datamgmt/jobs/353416747 👍 versus https://travis-ci.org/NCEAS/datamgmt/jobs/353409091 👎 ), but I'd like to be able to figure out the source of the bug. Is there maybe something I need to include in the yml files that I missed? I also wonder if it's related to #267?

Any help would be appreciated!

Most helpful comment

Ok, thanks for guiding me through the digging process!
In rebuilding the problem from the ground up, I located the real breaking point, which I figured I'd include here for completeness. Apparently, starting a vignette name with a numeric ("01-") triggers the inst/doc warning (reprex below).

library(devtools)                                                
library(roxygen2)                                                
create("pkg")                                                    
#> Creating package 'pkg' in '/home/isteves'
#> No DESCRIPTION found. Creating with values:
#> Package: pkg
#> Title: What the Package Does (one line, title case)
#> Version: 0.0.0.9000
#> Authors@R: person("First", "Last", email = "[email protected]", role = c("aut", "cre"))
#> Description: What the package does (one paragraph).
#> Depends: R (>= 3.4.3)
#> License: What license is it under?
#> Encoding: UTF-8
#> LazyData: true
#> * Creating `pkg.Rproj` from template.
#> * Adding `.Rproj.user`, `.Rhistory`, `.RData` to ./.gitignore
setwd("pkg")                                                     
devtools::document()                                             
#> Updating pkg documentation
#> Loading pkg
#> Updating roxygen version in /home/isteves/pkg/DESCRIPTION
#> Writing NAMESPACE
#add valid license (for example, "GPL-2") to remove license error
devtools::check()                                                
#> Updating pkg documentation
#> Loading pkg
#> Setting env vars ---------------------------------------------------------
#> CFLAGS  : -Wall -pedantic
#> CXXFLAGS: -Wall -pedantic
#> Building pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD build '/home/isteves/pkg' --no-resave-data --no-manual
#> 
#> Setting env vars ---------------------------------------------------------
#> _R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE
#> _R_CHECK_CRAN_INCOMING_           : FALSE
#> _R_CHECK_FORCE_SUGGESTS_          : FALSE
#> Checking pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD check '/tmp/Rtmp4UlcuP/pkg_0.0.0.9000.tar.gz' --as-cran  \
#>   --timings --no-manual
#> 
#> R CMD check results
#> 0 errors | 1 warning  | 0 notes
#> checking DESCRIPTION meta-information ... WARNING
#> Non-standard license specification:
#>   What license is it under?
#> Standardizable: FALSE
devtools::use_vignette("my-vignette")                            
#> * Creating `vignettes`.
#> * Adding `inst/doc` to ./.gitignore
#> NULL
devtools::check()                                                
#> Updating pkg documentation
#> Loading pkg
#> Setting env vars ---------------------------------------------------------
#> CFLAGS  : -Wall -pedantic
#> CXXFLAGS: -Wall -pedantic
#> Building pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD build '/home/isteves/pkg' --no-resave-data --no-manual
#> 
#> Setting env vars ---------------------------------------------------------
#> _R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE
#> _R_CHECK_CRAN_INCOMING_           : FALSE
#> _R_CHECK_FORCE_SUGGESTS_          : FALSE
#> Checking pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD check '/tmp/Rtmp4UlcuP/pkg_0.0.0.9000.tar.gz' --as-cran  \
#>   --timings --no-manual
#> 
#> R CMD check results
#> 0 errors | 1 warning  | 0 notes
#> checking DESCRIPTION meta-information ... WARNING
#> Non-standard license specification:
#>   What license is it under?
#> Standardizable: FALSE
file.rename("vignettes/my-vignette.Rmd",                         
"vignettes/a-my-vignette.Rmd")                                   
#> [1] TRUE
devtools::check()                                                
#> Updating pkg documentation
#> Loading pkg
#> Setting env vars ---------------------------------------------------------
#> CFLAGS  : -Wall -pedantic
#> CXXFLAGS: -Wall -pedantic
#> Building pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD build '/home/isteves/pkg' --no-resave-data --no-manual
#> 
#> Setting env vars ---------------------------------------------------------
#> _R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE
#> _R_CHECK_CRAN_INCOMING_           : FALSE
#> _R_CHECK_FORCE_SUGGESTS_          : FALSE
#> Checking pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD check '/tmp/Rtmp4UlcuP/pkg_0.0.0.9000.tar.gz' --as-cran  \
#>   --timings --no-manual
#> 
#> R CMD check results
#> 0 errors | 1 warning  | 0 notes
#> checking DESCRIPTION meta-information ... WARNING
#> Non-standard license specification:
#>   What license is it under?
#> Standardizable: FALSE
file.rename("vignettes/a-my-vignette.Rmd",                       
"vignettes/01-my-vignette.Rmd")                                  
#> [1] TRUE
devtools::check()                                                
#> Updating pkg documentation
#> Loading pkg
#> Setting env vars ---------------------------------------------------------
#> CFLAGS  : -Wall -pedantic
#> CXXFLAGS: -Wall -pedantic
#> Building pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD build '/home/isteves/pkg' --no-resave-data --no-manual
#> 
#> Setting env vars ---------------------------------------------------------
#> _R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE
#> _R_CHECK_CRAN_INCOMING_           : FALSE
#> _R_CHECK_FORCE_SUGGESTS_          : FALSE
#> Checking pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD check '/tmp/Rtmp4UlcuP/pkg_0.0.0.9000.tar.gz' --as-cran  \
#>   --timings --no-manual
#> 
#> R CMD check results
#> 0 errors | 2 warnings | 0 notes
#> checking DESCRIPTION meta-information ... WARNING
#> Non-standard license specification:
#>   What license is it under?
#> Standardizable: FALSE
#> 
#> checking package subdirectories ... WARNING
#> Subdirectory 'inst/doc' contains invalid file names:
#>   ‘01-my-vignette.Rmd’ ‘01-my-vignette.html’
#> Please remove or rename the files.
#> See section ‘Package subdirectories’ in the ‘Writing R Extensions’
#> manual.

All 12 comments

How are the files in inst/doc getting created?

I'm not sure. It's auto-creating when I include the vignettes and I haven't been able to figure out how stop it. How is the vignettes output directory specified?

When are they created? i.e. what function do you run that causes them to be created?

Travis will create them, and devtools::check() also gets the same error.

Why do you think it's related to pkgdown?

This was my overall workflow:

  1. Create vignettes folder/rmd - Travis/devtools::check() were happy
  2. Try to create a pkgdown page - the error about building inst/docs shows up

Since I only started getting errors after trying pkgdown, I figured it was probably related, but you're right, it could be a problem elsewhere!

I just found this note in this note for devtools 0.8.0, but I can't figure out where the warning "lives" in the code.

build_vignettes now looks in modern location for vignettes (vignettes/) and warn if vignettes found in old location (inst/doc). Building now occurs in a temporary directory (to avoid polluting the package with build artefacts) and only final pdf files are copied over.

Since I never see the inst/doc folder, I wonder if some function run by devtools::check() creates a temporary inst/doc folder, but the warning check occurs before the temporary directory is deleted. How do I investigate this further?

This sort of question is a better fit for https://community.rstudio.com. Do you mind asking it over there? (You might want to read https://www.tidyverse.org/help/ first to maximise your chances of getting a good answer)

Ok, thanks for guiding me through the digging process!
In rebuilding the problem from the ground up, I located the real breaking point, which I figured I'd include here for completeness. Apparently, starting a vignette name with a numeric ("01-") triggers the inst/doc warning (reprex below).

library(devtools)                                                
library(roxygen2)                                                
create("pkg")                                                    
#> Creating package 'pkg' in '/home/isteves'
#> No DESCRIPTION found. Creating with values:
#> Package: pkg
#> Title: What the Package Does (one line, title case)
#> Version: 0.0.0.9000
#> Authors@R: person("First", "Last", email = "[email protected]", role = c("aut", "cre"))
#> Description: What the package does (one paragraph).
#> Depends: R (>= 3.4.3)
#> License: What license is it under?
#> Encoding: UTF-8
#> LazyData: true
#> * Creating `pkg.Rproj` from template.
#> * Adding `.Rproj.user`, `.Rhistory`, `.RData` to ./.gitignore
setwd("pkg")                                                     
devtools::document()                                             
#> Updating pkg documentation
#> Loading pkg
#> Updating roxygen version in /home/isteves/pkg/DESCRIPTION
#> Writing NAMESPACE
#add valid license (for example, "GPL-2") to remove license error
devtools::check()                                                
#> Updating pkg documentation
#> Loading pkg
#> Setting env vars ---------------------------------------------------------
#> CFLAGS  : -Wall -pedantic
#> CXXFLAGS: -Wall -pedantic
#> Building pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD build '/home/isteves/pkg' --no-resave-data --no-manual
#> 
#> Setting env vars ---------------------------------------------------------
#> _R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE
#> _R_CHECK_CRAN_INCOMING_           : FALSE
#> _R_CHECK_FORCE_SUGGESTS_          : FALSE
#> Checking pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD check '/tmp/Rtmp4UlcuP/pkg_0.0.0.9000.tar.gz' --as-cran  \
#>   --timings --no-manual
#> 
#> R CMD check results
#> 0 errors | 1 warning  | 0 notes
#> checking DESCRIPTION meta-information ... WARNING
#> Non-standard license specification:
#>   What license is it under?
#> Standardizable: FALSE
devtools::use_vignette("my-vignette")                            
#> * Creating `vignettes`.
#> * Adding `inst/doc` to ./.gitignore
#> NULL
devtools::check()                                                
#> Updating pkg documentation
#> Loading pkg
#> Setting env vars ---------------------------------------------------------
#> CFLAGS  : -Wall -pedantic
#> CXXFLAGS: -Wall -pedantic
#> Building pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD build '/home/isteves/pkg' --no-resave-data --no-manual
#> 
#> Setting env vars ---------------------------------------------------------
#> _R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE
#> _R_CHECK_CRAN_INCOMING_           : FALSE
#> _R_CHECK_FORCE_SUGGESTS_          : FALSE
#> Checking pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD check '/tmp/Rtmp4UlcuP/pkg_0.0.0.9000.tar.gz' --as-cran  \
#>   --timings --no-manual
#> 
#> R CMD check results
#> 0 errors | 1 warning  | 0 notes
#> checking DESCRIPTION meta-information ... WARNING
#> Non-standard license specification:
#>   What license is it under?
#> Standardizable: FALSE
file.rename("vignettes/my-vignette.Rmd",                         
"vignettes/a-my-vignette.Rmd")                                   
#> [1] TRUE
devtools::check()                                                
#> Updating pkg documentation
#> Loading pkg
#> Setting env vars ---------------------------------------------------------
#> CFLAGS  : -Wall -pedantic
#> CXXFLAGS: -Wall -pedantic
#> Building pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD build '/home/isteves/pkg' --no-resave-data --no-manual
#> 
#> Setting env vars ---------------------------------------------------------
#> _R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE
#> _R_CHECK_CRAN_INCOMING_           : FALSE
#> _R_CHECK_FORCE_SUGGESTS_          : FALSE
#> Checking pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD check '/tmp/Rtmp4UlcuP/pkg_0.0.0.9000.tar.gz' --as-cran  \
#>   --timings --no-manual
#> 
#> R CMD check results
#> 0 errors | 1 warning  | 0 notes
#> checking DESCRIPTION meta-information ... WARNING
#> Non-standard license specification:
#>   What license is it under?
#> Standardizable: FALSE
file.rename("vignettes/a-my-vignette.Rmd",                       
"vignettes/01-my-vignette.Rmd")                                  
#> [1] TRUE
devtools::check()                                                
#> Updating pkg documentation
#> Loading pkg
#> Setting env vars ---------------------------------------------------------
#> CFLAGS  : -Wall -pedantic
#> CXXFLAGS: -Wall -pedantic
#> Building pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD build '/home/isteves/pkg' --no-resave-data --no-manual
#> 
#> Setting env vars ---------------------------------------------------------
#> _R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE
#> _R_CHECK_CRAN_INCOMING_           : FALSE
#> _R_CHECK_FORCE_SUGGESTS_          : FALSE
#> Checking pkg -------------------------------------------------------------
#> '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
#>   --quiet CMD check '/tmp/Rtmp4UlcuP/pkg_0.0.0.9000.tar.gz' --as-cran  \
#>   --timings --no-manual
#> 
#> R CMD check results
#> 0 errors | 2 warnings | 0 notes
#> checking DESCRIPTION meta-information ... WARNING
#> Non-standard license specification:
#>   What license is it under?
#> Standardizable: FALSE
#> 
#> checking package subdirectories ... WARNING
#> Subdirectory 'inst/doc' contains invalid file names:
#>   ‘01-my-vignette.Rmd’ ‘01-my-vignette.html’
#> Please remove or rename the files.
#> See section ‘Package subdirectories’ in the ‘Writing R Extensions’
#> manual.

I have the same issue. Is this a bug?

devtools::use_vignette() is deprecated. Does this happen if you use the recommended usethis::use_vignette()?

I'm sure if I follow. The error does occur with
usethis::use_vignette("1-introduction")

The file vignettes/1-introduction.Rmd is created without problems.

The warning is created with devtools::check() (or Build>Check menu).

 R CMD check results
❯ checking package subdirectories ... WARNING
  Subdirectory 'inst/doc' contains invalid file names:
'1-introduction.Rmd`

No warnings for vignette file names without leading number. e.g. introduction.Rmd works fine.

The problem is that it's an invalid filename, not a pkgdown problem.

usethis::use_vignette() should warn that the filename is invalid. Will file an issue there.

Was this page helpful?
0 / 5 - 0 ratings