pkgdown 1.1.0 does not process \doi tags

Created on 6 Jun 2018  Β·  25Comments  Β·  Source: r-lib/pkgdown

When I use build_site() with my package (https://github.com/strengejacke/sjstats), I get following error for _pkgdown 1.1.0_:

Reading 'man/deff.Rd'
Error: x must be a string or a R connection
Execution halted

Reverting to pkgdown 1.0.0 solves the problem, there's no error then.

bug

All 25 comments

I get a clean build using pkgdown master with your most recent commit.

https://vigorous-fermi-749ebd.netlify.com/

pandoc: 2.2.1
pkgdown: 1.1.0.9000
pkgdown_sha: ~
articles:
  anova-statistics: anova-statistics.html
  bayesian-statistics: bayesian-statistics.html
  mixedmodels-statistics: mixedmodels-statistics.html

Can you run pkgdown::clean_site() and then pkgdown::build_site() again?

Hm, no that doesn't work. I have changed some functions in between, but did not touch deff() (so deff.rd should be the same on GitHub as on my PC - and I already had the problem yesterday, before doing any new changes).

I'll commit the latest files to commit to github later and will give a note here, so you may check again if the site can still be built with your setup.

Ok, I just checked from another PC (Windows 10) with the current GitHub-Version (https://github.com/strengejacke/sjstats) and pkgdown 1.1.0 (R 3.5.0), and the same error occured (after cleaning the docs directory).

I am having the same issue with the documentation of a package not publishable yet, so unfortunately I can't provide an example to reproduce the error.

Starting with commit b6ad392 I get the following error message when using build_site:

Error in paste0(qname, "()") : object 'qname' not found
Call: <Anonymous> ... .f -> <Anonymous> -> .Call -> .f -> short_name -> paste0

The commits 1075ee6, 3e8f197 and f2c2b37 do not resolve this error. It is fixed by commit 0af3a81, which finally leads to an error message similar to the one described by @strengejacke:

Reading 'man/df.flys.Rd'
Error: `x` must be a string or a R connection
Execution halted

My sessionInfo() is:

R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS: /opt/i4/R-3.5.0/lib64/R/lib/libRblas.so
LAPACK: /opt/i4/R-3.5.0/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] pkgdown_1.0.0.9000 rmarkdown_1.10     knitr_1.20         RPostgreSQL_0.6-2
[5] DBI_1.0.0          devtools_1.13.5

loaded via a namespace (and not attached):
 [1] roxygen2_6.0.1  Rcpp_0.12.17    digest_0.6.15   withr_2.1.2
 [5] rprojroot_1.3-2 commonmark_1.5  MASS_7.3-50     R6_2.2.2
 [9] backports_1.1.2 magrittr_1.5    evaluate_0.10.1 rlang_0.2.1
[13] stringi_1.2.2   fs_1.2.3        xml2_1.2.0      tools_3.5.0
[17] stringr_1.3.1   compiler_3.5.0  memoise_1.1.0   htmltools_0.3.6

The traceback() information is:

27: stop(cnd)
26: abort("`x` must be a string or a R connection")
25: parse_exprs(args)
24: parse_opts(attr(x, "Rd_option"))
23: as_html.tag_Sexpr(.x[[i]], ...)
22: .f(.x[[i]], ...)
21: .Call(map_impl, environment(), ".x", ".f", "character")
20: purrr::map_chr(x, as_html, ...)
19: flatten_para(x, ...)
18: parse_section(x, "References", ...)
17: as_data.tag_references(.x[[i]], ...)
16: .f(.x[[i]], ...)
15: .Call(map_impl, environment(), ".x", ".f", "list")
14: purrr::map(., as_data)
13: function_list[[i]](value)
12: freduce(value, `_function_list`)
11: `_fseq`(`_lhs`)
10: eval(quote(`_fseq`(`_lhs`)), env, env)
9: eval(quote(`_fseq`(`_lhs`)), env, env)
8: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
7: sections %>% purrr::map(as_data) %>% purrr::map(add_slug)
6: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run, 
       mathjax = mathjax)
5: .f(.x[[i]], ...)
4: .Call(map_impl, environment(), ".x", ".f", "list")
3: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, 
       examples = examples, run_dont_run = run_dont_run, mathjax = mathjax)
2: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run, 
       mathjax = mathjax, seed = seed, override = override, preview = FALSE)
1: pkgdown::build_site(".", examples = TRUE, preview = FALSE, override = list(destination = public))

At the moment I simply stick to pkgdown 1.0.0 installed through devtools::install_github("r-lib/pkgdown", ref = "d18a0ac"), but a solution trough an updated version of pkgdown would be highly appreciated.

I get the same error (Error:xmust be a string or a R connection) when pkgdown is reading one of the man/.Rd files and it still haunts me.

Here's what I tried so far to solve it:
I tried reinstalling pkgdown from the master branch on github as well as from CRAN and also different versions of my package (ampvis2) and narrowed it down to 1 commit (https://github.com/MadsAlbertsen/ampvis2/commit/e57217236bf194c1a7a269b58a8067318461aac6), where the commit before that ran fine with pkgdown::clean_site(); pkgdown::build_site(), and the particular commit did not. The only difference between the two commits were in _pkgdown.yml, so I tried using the content of the working commit, and it ran into the error again. That I don't understand!

I also noticed that running pkgdown::clean_site(); pkgdown::build_site() with the working commit more than once also would give the error. The first time I ran pkgdown::clean_site(); pkgdown::build_site() it was writing NAMESPACE and all the .Rd man files again, but it didn't the second time, where it also stopped with the error. Then I thought perhaps roxygen2 was creating problems so I tried running devtools::document() before building as well as installing the dev-version from github with devtools::install_github("klutometis/roxygen"). I then get the same error and the same behavior where first time runs fine and the second doesn't, but it also says that roxygen2 requires UTF-8 encoding:

Error: `x` must be a string or a R connection
In addition: Warning message:
roxygen2 requires Encoding: UTF-8 
Execution halted
Error: `x` must be a string or a R connection

So maybe it's caused by some encoding issues, but I am stuck here. I tried adding Encoding: UTF-8 to the DESCRIPTION file but it didn't make a difference nor did saving the particular .Rd file as UTF-8 using a text-editor or setting default text encoding in RStudio to UTF-8.

I'd like to try on a different machine, but that's not going to be before next week.

Supplemental details:

build_site()

> pkgdown::clean_site(); pkgdown::build_site()
══ Building pkgdown site ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Reading from: '/home/kapper/Downloads/ampvis2-master'
Writing to:   '/home/kapper/Downloads/ampvis2-master/docs'
── Initialising site ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Copying '../../R/x86_64-pc-linux-gnu-library/3.5/pkgdown/assets/docsearch.css' to 'docsearch.css'
Copying '../../R/x86_64-pc-linux-gnu-library/3.5/pkgdown/assets/docsearch.js' to 'docsearch.js'
Copying '../../R/x86_64-pc-linux-gnu-library/3.5/pkgdown/assets/link.svg' to 'link.svg'
Copying '../../R/x86_64-pc-linux-gnu-library/3.5/pkgdown/assets/pkgdown.css' to 'pkgdown.css'
Copying '../../R/x86_64-pc-linux-gnu-library/3.5/pkgdown/assets/pkgdown.js' to 'pkgdown.js'
Writing 'sitemap.xml'
Writing '/home/kapper/Downloads/ampvis2-master/docs/docsearch.json'
● Edit '_pkgdown.yml'
── Building home ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Writing 'authors.html'
Reading 'ISSUE_TEMPLATE.md'
Writing 'ISSUE_TEMPLATE.html'
Writing 'LICENSE-text.html'
Reading 'README.Rmd'
Writing 'index.html'
── Building function reference ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Updating ampvis2 documentation
Loading ampvis2
Loading required package: ggplot2
Writing NAMESPACE
Writing NAMESPACE
Warning: Topics missing from index: AalborgWWTPs, MiDAS, MiF, amp_cleanMiF, amp_rarefy, amp_rename, example_metadata, example_otutable, print.ampvis2
Writing 'reference/index.html'
Loading ampvis2
Reading 'man/AalborgWWTPs.Rd'
Writing 'reference/AalborgWWTPs.html'
Reading 'man/MiDAS.Rd'
Writing 'reference/MiDAS.html'
Reading 'man/MiF.Rd'
Writing 'reference/MiF.html'
Reading 'man/amp_alphadiv.Rd'
Error: `x` must be a string or a R connection
Execution halted
Error: `x` must be a string or a R connection


traceback()

> traceback()
5: stop(err[[2]])
4: get_result(output = out, options)
3: callr::r(function(...) pkgdown::build_site(...), args = args, 
       show = TRUE)
2: build_site_external(pkg = pkg, examples = examples, document = document, 
       run_dont_run = run_dont_run, seed = seed, mathjax = mathjax, 
       lazy = lazy, override = override, preview = preview)
1: pkgdown::build_site()


sessionInfo()

R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04 LTS

Matrix products: default
BLAS: /usr/local/lib/R/lib/libRblas.so
LAPACK: /usr/local/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_DK.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_DK.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_DK.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_DK.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] ampvis2_2.3.14     forcats_0.3.0      stringr_1.3.1      dplyr_0.7.5        purrr_0.2.5        readr_1.1.1        tidyr_0.8.1       
 [8] tibble_1.4.2       ggplot2_2.2.1.9000 tidyverse_1.2.1   

loaded via a namespace (and not attached):
  [1] colorspace_1.3-2            rsconnect_0.8.8             rprojroot_1.3-2             htmlTable_1.12              XVector_0.20.0             
  [6] fs_1.2.3                    GenomicRanges_1.32.3        base64enc_0.1-3             rstudioapi_0.7              roxygen2_6.0.1.9000        
 [11] remotes_1.1.1               bit64_0.9-7                 ggrepel_0.8.0               ggnet_0.1.0                 AnnotationDbi_1.42.1       
 [16] lubridate_1.7.4             xml2_1.2.0                  splines_3.5.0               mnormt_1.5-5                geneplotter_1.58.0         
 [21] knitr_1.20                  pkgload_1.0.0               Formula_1.2-3               jsonlite_1.5                annotate_1.58.0            
 [26] broom_0.4.4                 cluster_2.0.7-1             compiler_3.5.0              httr_1.3.1                  backports_1.1.2            
 [31] assertthat_0.2.0            Matrix_1.2-14               lazyeval_0.2.1              cli_1.0.0                   acepack_1.4.1              
 [36] htmltools_0.3.6             tools_3.5.0                 bindrcpp_0.2.2              gtable_0.2.0                glue_1.2.0                 
 [41] GenomeInfoDbData_1.1.0      reshape2_1.4.3              Rcpp_0.12.17                Biobase_2.40.0              pkgdown_1.1.0.9000         
 [46] cellranger_1.1.0            ape_5.1                     nlme_3.1-137                psych_1.8.4                 network_1.13.0.1           
 [51] testthat_2.0.0              rvest_0.3.2                 devtools_1.13.5             GUniFrac_1.1                XML_3.98-1.11              
 [56] MASS_7.3-49                 zlibbioc_1.26.0             scales_0.5.0                hms_0.4.2                   parallel_3.5.0             
 [61] SummarizedExperiment_1.10.1 biomformat_1.8.0            rhdf5_2.24.0                RColorBrewer_1.1-2          yaml_2.1.19                
 [66] memoise_1.1.0               gridExtra_2.3               rpart_4.1-13                RSQLite_2.1.1               latticeExtra_0.6-28        
 [71] stringi_1.2.3               genefilter_1.62.0           S4Vectors_0.18.3            desc_1.2.0                  checkmate_1.8.5            
 [76] permute_0.9-4               BiocGenerics_0.26.0         pkgbuild_1.0.0              BiocParallel_1.14.1         GenomeInfoDb_1.16.0        
 [81] rlang_0.2.1                 pkgconfig_2.0.1             commonmark_1.5              matrixStats_0.53.1          bitops_1.0-6               
 [86] evaluate_0.10.1             lattice_0.20-35             Rhdf5lib_1.2.1              bindr_0.1.1                 htmlwidgets_1.2            
 [91] bit_1.1-14                  cowplot_0.9.2               processx_3.1.0              tidyselect_0.2.4            plyr_1.8.4                 
 [96] magrittr_1.5                DESeq2_1.20.0               R6_2.2.2                    IRanges_2.14.10             Hmisc_4.1-1                
[101] DBI_1.0.0                   DelayedArray_0.6.0          pillar_1.2.3                haven_1.1.1                 foreign_0.8-70             
[106] withr_2.1.2                 mgcv_1.8-23                 survival_2.41-3             RCurl_1.95-4.10             nnet_7.3-12                
[111] modelr_0.1.2                crayon_1.3.4                plotly_4.7.1                rmarkdown_1.10              locfit_1.5-9.1             
[116] grid_3.5.0                  readxl_1.1.0                data.table_1.11.4           blob_1.1.1                  callr_2.0.4                
[121] vegan_2.5-2                 digest_0.6.15               xtable_1.8-2                stats4_3.5.0                munsell_0.5.0              
[126] viridisLite_0.3.0          

Has anyone narrowed this down to a specific R/Rd file that could be incorporated into a minimal package for debugging?

See my initial post: a lot of rd-files work fine, but it stops at _deff.rd_ - without any logical reasons for me, as I haven't revised that function or docs for a long time. And all works perfect with pkgdown 1.0.0.

Can someone try running clean_site() and then build_site(new_process=FALSE)?

Unfortunately I can't reproduce the error, my builds are clean.

I have updated to pkgdown master and executed clean_site(); build_site(). It does not change the final error which causes the execution to halt.

A new issue showing up is related to the output directory. Depending on the used version of R I am modifying the outputs _destination_ and thereby overwrite a standard value set in _pkgdown.yml. The overwritten _destination_ is respected in the way that produced html files can be found in there, but an additional, unwanted _docs/_ directory is created. Should I report this issue separatly or could it be part of the problem?

Depending on time availability I will try to to provide a reproducible example ...


build_site


══ Building pkgdown site ═══════════════════════════════════════════════════════
Reading from: '/srv/cifs-mounts/WeberA_home/WeberA/hyd1d'
Writing to: '/srv/cifs-mounts/WeberA_home/WeberA/hyd1d/public/3.5.0'
── Initialising site ───────────────────────────────────────────────────────────
Copying '../../../../../home/WeberA/R/3.5.0/pkgdown/assets/docsearch.css' to 'docsearch.css'
Copying '../../../../../home/WeberA/R/3.5.0/pkgdown/assets/docsearch.js' to 'docsearch.js'
Copying '../../../../../home/WeberA/R/3.5.0/pkgdown/assets/link.svg' to 'link.svg'
Copying '../../../../../home/WeberA/R/3.5.0/pkgdown/assets/pkgdown.css' to 'pkgdown.css'
Copying '../../../../../home/WeberA/R/3.5.0/pkgdown/assets/pkgdown.js' to 'pkgdown.js'
Copying 'pkgdown/extra.css' to 'extra.css'
Writing 'sitemap.xml'
● Edit '_pkgdown.yml'
βœ” Creating 'docs/'
── Building home ───────────────────────────────────────────────────────────────
Writing 'authors.html'
Reading 'README.Rmd'
Writing 'index.html'
── Building function reference ─────────────────────────────────────────────────
Updating hyd1d documentation
Loading hyd1d
Creating a new generic function for β€˜summary’ in package β€˜hyd1d’
Warning: Topics missing from index: hyd1d
Writing 'reference/index.html'
Copying 'man/figures/flys3waterlevels.pdf' to 'reference/figures/flys3waterlevels.pdf'
Copying 'man/figures/flys3waterlevels.png' to 'reference/figures/flys3waterlevels.png'
Loading hyd1d
Creating a new generic function for β€˜summary’ in package β€˜hyd1d’
Reading 'man/WaterLevelDataFrame-class.Rd'
Writing 'reference/WaterLevelDataFrame-class.html'
Reading 'man/WaterLevelDataFrame.Rd'
Writing 'reference/WaterLevelDataFrame.html'
Reading 'man/as.data.frame.WaterLevelDataFrame.Rd'
Writing 'reference/as.data.frame.WaterLevelDataFrame.html'
Reading 'man/date_gauging_data.Rd'
Writing 'reference/date_gauging_data.html'
Reading 'man/df.flys.Rd'
Error: x must be a string or a R connection
Execution halted


traceback


28: stop(cnd)
27: abort("x must be a string or a R connection")
26: parse_exprs(args)
25: parse_opts(attr(x, "Rd_option"))
24: as_html.tag_Sexpr(.x[[i]], ...)
23: .f(.x[[i]], ...)
22: .Call(map_impl, environment(), ".x", ".f", "character")
21: purrr::map_chr(x, as_html, ...)
20: flatten_para(x, ...)
19: parse_section(x, "References", ...)
18: as_data.tag_references(.x[[i]], ...)
17: .f(.x[[i]], ...)
16: .Call(map_impl, environment(), ".x", ".f", "list")
15: purrr::map(., as_data)
14: function_list[i]
13: freduce(value, _function_list)
12: _fseq(_lhs)
11: eval(quote(_fseq(_lhs)), env, env)
10: eval(quote(_fseq(_lhs)), env, env)
9: withVisible(eval(quote(_fseq(_lhs)), env, env))
8: sections %>% purrr::map(as_data) %>% purrr::map(add_slug)
7: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run,
mathjax = mathjax)
6: .f(.x[[i]], ...)
5: .Call(map_impl, environment(), ".x", ".f", "list")
4: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy,
examples = examples, run_dont_run = run_dont_run, mathjax = mathjax)
3: build_reference(pkg, lazy = lazy, document = document, examples = examples,
run_dont_run = run_dont_run, mathjax = mathjax, seed = seed,
override = override, preview = FALSE)
2: build_site_local(pkg = pkg, examples = examples, document = document,
run_dont_run = run_dont_run, seed = seed, mathjax = mathjax,
lazy = lazy, override = override, preview = preview)
1: pkgdown::build_site(".", examples = TRUE, preview = FALSE, override = list(destination = public),
new_process = FALSE)


sessionInfo


R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS: /opt/i4/R-3.5.0/lib64/R/lib/libRblas.so
LAPACK: /opt/i4/R-3.5.0/lib64/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] pkgdown_1.1.0.9000 rmarkdown_1.10 knitr_1.20 RPostgreSQL_0.6-2
[5] DBI_1.0.0 devtools_1.13.5

loaded via a namespace (and not attached):
[1] roxygen2_6.0.1 Rcpp_0.12.17 digest_0.6.15 withr_2.1.2
[5] rprojroot_1.3-2 commonmark_1.5 MASS_7.3-50 R6_2.2.2
[9] backports_1.1.2 magrittr_1.5 evaluate_0.10.1 rlang_0.2.1
[13] stringi_1.2.2 fs_1.2.3 xml2_1.2.0 tools_3.5.0
[17] stringr_1.3.1 compiler_3.5.0 memoise_1.1.0 htmltools_0.3.6

I re-installed the latest GitHub-build of _pkgdown_ and checked another package, the same problem occurs:

Here is the long version of the output, including the traceback:

> pkgdown::clean_site()
> pkgdown::build_site(new_process = F)
== Building pkgdown site =======================================================
Reading from: 'C:/Users/Daniel/Documents/Yavin-4/R/packages/sjmisc'
Writing to:   'C:/Users/Daniel/Documents/Yavin-4/R/packages/sjmisc/docs'
-- Initialising site -----------------------------------------------------------
Copying '../../../../R/win-library/3.5/pkgdown/assets/docsearch.css' to 'docsearch.css'
Copying '../../../../R/win-library/3.5/pkgdown/assets/docsearch.js' to 'docsearch.js'
Copying '../../../../R/win-library/3.5/pkgdown/assets/link.svg' to 'link.svg'
Copying '../../../../R/win-library/3.5/pkgdown/assets/pkgdown.css' to 'pkgdown.css'
Copying '../../../../R/win-library/3.5/pkgdown/assets/pkgdown.js' to 'pkgdown.js'
Copying 'man/figures/logo.png' to 'logo.png'
Creating 'favicon.ico'
● Modify '_pkgdown.yml'
βœ” Adding '^_pkgdown\\.yml$' to '.Rbuildignore'
-- Building home ---------------------------------------------------------------
Writing 'authors.html'
Reading 'CODE_OF_CONDUCT.md'
Writing 'CODE_OF_CONDUCT.html'
Reading 'CONTRIBUTING.md'
Writing 'CONTRIBUTING.html'
Reading 'paper.md'
Writing 'paper.html'
Writing 'LICENSE-text.html'
Writing 'index.html'
-- Building function reference -------------------------------------------------
Updating sjmisc documentation
Loading sjmisc
Writing 'reference/index.html'
Copying 'man/figures/logo.png' to 'reference/figures/logo.png'
Loading sjmisc
Reading 'man/add_columns.Rd'
Writing 'reference/add_columns.html'
Reading 'man/add_rows.Rd'
Writing 'reference/add_rows.html'
Reading 'man/all_na.Rd'
Writing 'reference/all_na.html'
Reading 'man/big_mark.Rd'
Writing 'reference/big_mark.html'
Reading 'man/count_na.Rd'
Writing 'reference/count_na.html'
Reading 'man/descr.Rd'
Writing 'reference/descr.html'
Reading 'man/dicho.Rd'
Writing 'reference/dicho.html'
Reading 'man/efc.Rd'
Writing 'reference/efc.html'
Reading 'man/empty_cols.Rd'
Writing 'reference/empty_cols.html'
Reading 'man/find_var.Rd'
Writing 'reference/find_var.html'
Reading 'man/flat_table.Rd'
Writing 'reference/flat_table.html'
Reading 'man/frq.Rd'
Writing 'reference/frq.html'
Reading 'man/grapes-nin-grapes.Rd'
Writing 'reference/grapes-nin-grapes.html'
Reading 'man/group_str.Rd'
Writing 'reference/group_str.html'
Reading 'man/group_var.Rd'
Writing 'reference/group_var.html'
Reading 'man/is_crossed.Rd'
Writing 'reference/is_crossed.html'
Reading 'man/is_empty.Rd'
Writing 'reference/is_empty.html'
Reading 'man/is_even.Rd'
Writing 'reference/is_even.html'
Reading 'man/is_float.Rd'
Writing 'reference/is_float.html'
Reading 'man/is_num_fac.Rd'
Writing 'reference/is_num_fac.html'
Reading 'man/merge_imputations.Rd'
Error: `x` must be a string or a R connection
> traceback()
25: stop(cnd)
24: abort("`x` must be a string or a R connection")
23: parse_exprs(args)
22: parse_opts(attr(x, "Rd_option"))
21: as_html.tag_Sexpr(.x[[i]], ...)
20: .f(.x[[i]], ...)
19: purrr::map_chr(x, as_html, ...)
18: flatten_para(x, ...)
17: parse_section(x, "References", ...)
16: as_data.tag_references(.x[[i]], ...)
15: .f(.x[[i]], ...)
14: purrr::map(., as_data)
13: function_list[[i]](value)
12: freduce(value, `_function_list`)
11: `_fseq`(`_lhs`)
10: eval(quote(`_fseq`(`_lhs`)), env, env)
9: eval(quote(`_fseq`(`_lhs`)), env, env)
8: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
7: sections %>% purrr::map(as_data) %>% purrr::map(add_slug)
6: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run, 
       mathjax = mathjax)
5: .f(.x[[i]], ...)
4: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy, 
       examples = examples, run_dont_run = run_dont_run, mathjax = mathjax)
3: build_reference(pkg, lazy = lazy, document = document, examples = examples, 
       run_dont_run = run_dont_run, mathjax = mathjax, seed = seed, 
       override = override, preview = FALSE)
2: build_site_local(pkg = pkg, examples = examples, document = document, 
       run_dont_run = run_dont_run, seed = seed, mathjax = mathjax, 
       lazy = lazy, override = override, preview = preview)
1: pkgdown::build_site(new_process = F)

@aqualogy The /docs folder is where pkgdown builds the webpage, so that's expected.

@jayhesselberth In my case it's this .Rd-file.

  • Running pkgdown::clean_site(); pkgdown::build_site(new_process = FALSE) results in the same error.
  • utf8::utf8_valid("man/amp_alphadiv.Rd") yields TRUE.
  • I just tried running pkgdown::clean_site(); pkgdown::build_site() with @strengejacke's sjstats package and were able to reproduce the error.
  • I have made a minimal package that also results in the error for debugging here

One problem is the \doi tag. A minimal package with only the file:

#' \doi{blah}
test <- function() {}

triggers Error:xmust be a string or a R connection.

For reference:

devtools::load_all("~/devel/pkgdown")
#> Loading pkgdown

rd_text("\\doi{10.1177/0163278703255230}")
#> \Sexpr[results=rd,stage=build]{tools:::Rd_expr_doi("#1")}10.1177/0163278703255230[results=rd,stage=build]{tools:::Rd_expr_doi("10.1177/0163278703255230")}

tools:::Rd_expr_doi("10.11177/0163278703255230")
#> [1] "\\ifelse{text}{doi: 10.11177/0163278703255230 (URL: http://doi.org/10.11177/0163278703255230)}{\\ifelse{latex}{doi:\\out{\\nobreakspace{}}\\href{http://doi.org/10.11177/0163278703255230}{10.11177\\out{\\slash{}}0163278703255230}}{doi: \\href{http://doi.org/10.11177/0163278703255230}{10.11177/0163278703255230}}}"

# rd2html deals with this OK
rd2html(tools:::Rd_expr_doi("10.11177/0163278703255230"))
#> [1] "doi: <a href='http://doi.org/10.11177/0163278703255230'>10.11177/0163278703255230</a>"

Created on 2018-06-15 by the reprex package (v0.2.0).

I haven't checked systematically yet, but I can confirm that for all .rd-file I remember where an error occured, these also contained a doi-tag.

In the meantime I have also prepared an example package:

https://github.com/aqualogy/pdtest720

First I suspected the Rdpack macro \insertRef as error source, but in the meantime I can confirm the Rd-files \doi tag as error source, too. During execution of _build.R build_site() fails for df.flys4.Rd, which is the first of five variations of df.flys?.Rd that includes the \doi tag. The three previous versions (df.flys1.Rd, df.flys2.Rd, df.flys3.Rd) work well, the later two with \doi tag or \insertRef tag fail.

@KasperSkytte Since I used to explicitely overwrite the _destination_ of the output to a subdirectory of _public/_ (Gitlab's standard directory for static html output) depending on the R version (_public/R-3.5.0/_), I didn't expect to get a directory _docs/_ produced by build_site(). In the meantime I have reported this as separate issue: https://github.com/r-lib/pkgdown/issues/734

I removed \doi{} tags and now it runs perfectly. Who would have known. Thanks for the quick responses!

so what has changed with the parsing, as all works well in version 1.0.0?

Hmm, good question. Your DOI links were previously linked just fine using 1.0.0.

https://strengejacke.github.io/sjstats/reference/deff.html#references

It's most likely a change in rd-html.R between https://github.com/r-lib/pkgdown/compare/v1.0.0...v1.1.0

This test needs to pass:

test_that("DOIs are linked", {
  expect_equal(
    rd2html("\\doi{10.1177/0163278703255230}"),
    "doi: <a href='http://doi.org/10.11177/0163278703255230'>10.11177/0163278703255230</a>"
  )
})

The tag \insertRef of the Rd macro Rdpack is also not parsed and generates the same error.

\doi should be fixed by #738. Can someone confirm whether \insertRef is also fixed?

Not yet! After updating to current master (devtools::install_github("R-lib/pkgdown")) I still get an error at the first occurences of \doi and \insertRef.


sessionInfo()


R version 3.5.0 (2018-04-23)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] rmarkdown_1.10 knitr_1.20 devtools_1.13.5 pdtest720_0.1.0
[5] pkgdown_1.1.0.9000

loaded via a namespace (and not attached):
[1] Rcpp_0.12.17 xml2_1.2.0 magrittr_1.5 roxygen2_6.0.1
[5] MASS_7.3-50 debugme_1.1.0 R6_2.2.2 rlang_0.2.1
[9] bibtex_0.4.2 stringr_1.3.1 tools_3.5.0 withr_2.1.2
[13] htmltools_0.3.6 commonmark_1.5 yaml_2.1.19 assertthat_0.2.0
[17] digest_0.6.15 rprojroot_1.3-2 tibble_1.4.2 crayon_1.3.4
[21] processx_3.1.0 callr_2.0.4 purrr_0.2.5 Rdpack_0.8-0
[25] fs_1.2.3 gbRd_0.4-11 memoise_1.1.0 evaluate_0.10.1
[29] stringi_1.2.3 compiler_3.5.0 pillar_1.2.3 desc_1.2.0
[33] backports_1.1.2


traceback


5: stop(err[[2]])
4: get_result(output = out, options)
3: callr::r(function(...) pkgdown::build_site(...), args = args,
show = TRUE)
2: build_site_external(pkg = pkg, examples = examples, document = document,
run_dont_run = run_dont_run, seed = seed, mathjax = mathjax,
lazy = lazy, override = override, preview = preview)
1: pkgdown::build_site(".")

thanks, works for me now!

Same here! Thanks!

same here
what solved the problem for me was

library(devtools)
install_version("pkgdown", version = "1.0.0", repos = "http://cran.us.r-project.org")

It's fixed in the latest development version. Just install it with devtools::install_github("r-lib/pkgdown"), not the one from CRAN as it is not up to date.

I can confirm @KasperSkytte last comment. With current master, installed by devtools::install_github("r-lib/pkgdown") everything works well and \insertRef or \doi don't cause problems.

Was this page helpful?
0 / 5 - 0 ratings