Skip to content

[R-pkg-devel] error message when trying to knit a vignette involving data import

2 messages · Hüsing, Johannes, Sebastian Meyer

#
I am trying to puild a package including a vignette. The focus of this package is the generation of linkage tables connecting cancer diagnoses.
The following code is processed into a HTML document when invoked with rmarkdown::render(), but fails to be processed with devtools::build_vignettes():

---
title: "staduicc"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{staduicc}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```
# headline

```{r setup}
library(staduicc)
spieldatenpfad <- system.file("./inst/extdata/spieldaten.rda", package = "staduicc")
message(spieldatenpfad)
load(spieldatenpfad)
```
<end of Rmd code>

The message which comes with running the code is as follows:

? Installing staduicc in temporary library
? Building vignettes for staduicc
--- re-building 'staduicc.Rmd' using rmarkdown


processing file: staduicc.Rmd
1/5
2/5 [unnamed-chunk-1]
3/5
4/5 [setup]

Quitting from staduicc.Rmd:19-24 [setup]
Error: processing vignette 'staduicc.Rmd' failed with diagnostics:
cannot open the connection
--- failed re-building 'staduicc.Rmd'

SUMMARY: processing the following file failed:
  'staduicc.Rmd'

Error:
! in callr subprocess.
Caused by error:
! Vignette re-building failed.
? See `$stdout` and `$stderr` for standard output and error.
Type .Last.error to see the more details.
<end of error messages>

I am suspecting it may have something to do which how system.path() is processed. But I?ll gladly take any hint that is more specific than my musings.


Dr. Johannes H?sing
Epidemiologie

Landeskrebsregister NRW gGmbH
Gesundheitscampus 10
44801 Bochum

T 0234 54509-216
F 0234 54509-499
Johannes.Huesing at krebsregister.nrw.de<mailto:Johannes.Huesing at krebsregister.nrw.de>
www.landeskrebsregister.nrw<http://www.landeskrebsregister.nrw>

Das Landeskrebsregister NRW online
FACEBOOK: https://www.facebook.com/LKRNordrheinWestfalen/
INSTAGRAM: https://www.instagram.com/landeskrebsregister_nrw
LINKEDIN: https://www.linkedin.com/company/87452209/admin/feed/posts/

Newsletter LKR NRW - jetzt anmelden unter
 https://www.landeskrebsregister.nrw/aktuelles/newsletter


Gesch?ftsf?hrer
Dr. Andres Sch?tzend?bel
Vorsitzender der Gesellschafterversammlung
Staatssekret?r Matthias Heidmeier
Sitz der Gesellschaft
Bochum
Registergericht
Amtsgericht Bochum
HRB 17715

HINWEIS: Diese Nachricht ist nur f?r den Adressaten bestimmt. Es ist nicht erlaubt, diese Nachricht zu kopieren oder Dritten zug?nglich zu machen. Sollten Sie irrt?mlich diese Nachricht erhalten haben, bitte ich um Ihre Mitteilung per E-Mail oder unter der oben angegebenen Telefonnummer.
#
Am 11.02.26 um 08:39 schrieb H?sing, Johannes via R-package-devel:
system.file() finds files in an _installed_ package, which is what you 
want to access in a vignette. However, './inst/' only exists in your 
source package. At installation, the _contents_ of that subdirectory are 
copied recursively to the installation directory, so that will have 
'./extdata' at the root. I recommend installing the package and checking 
out its installation directory to see for yourself:

     (instdir <- find.package("staduicc"))
     browseURL(instdir)

(Browsing the directory should work via 'xdg-open' on Linux; I'm not 
sure about Windows, but you will know the path.)

	Sebastian Meyer