Disclaimer: I am building a package for local usage (for now), which will probably be not submitted to CRAN. If you view this posting as off topic, please say so or ignore. In a vignette like this one https://rdrr.io/cran/DBI/f/vignettes/DBI-advanced.Rmd, code is introduced that, on invocation, would try to establish a DB connection which probably would not exist on someone else's than the maintainer's configuration. Would the maintainer expect the user of the package to tweak her local configuration, or rather vignette script, to make the code run? The R packages book reads: Note that since you build vignettes locally, CRAN only receives the html/pdf and the source code. However, CRAN does not re-build the vignette. It only checks that the code is runnable (by running it). What happens when running the script on the user's configuration if the DB handle does not exist? Or indeed, when CRAN runs the code and no DB is built by running the code? This posting https://forum.posit.co/t/vignettes-that-require-locally-stored-data/2392 seems to come close to my question. Best Johannes 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 5. Landesqualit?tskonferenz Mittwoch 08. Oktober 2025 in M?nster 20 Jahre Krebsregistrierung f?r Nordrhein-Westfalen Eine Erfolgsgeschichte f?r die onkologische Forschung und Versorgung Anmeldung: https://www.landeskrebsregister.nrw/5-landesqualitaetskonferenz-nrw/ 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.
[R-pkg-devel] Drafting vignettes that require DB connection
3 messages · Hüsing, Johannes, Duncan Murdoch, Pepijn de Vries
Presumably when your code tries to open the database, it will fail with an error. What you should do is catch that error so the vignette doesn't fail, and print a message to the user explaining why things didn't work. If you are using knitr, you can call `knitr::knit_exit()` and it will quit at that point without appearing to fail. Duncan Murdoch
On 2025-08-18 9:06 a.m., H?sing, Johannes via R-package-devel wrote:
Disclaimer: I am building a package for local usage (for now), which will probably be not submitted to CRAN. If you view this posting as off topic, please say so or ignore. In a vignette like this one https://rdrr.io/cran/DBI/f/vignettes/DBI-advanced.Rmd, code is introduced that, on invocation, would try to establish a DB connection which probably would not exist on someone else's than the maintainer's configuration. Would the maintainer expect the user of the package to tweak her local configuration, or rather vignette script, to make the code run? The R packages book reads: Note that since you build vignettes locally, CRAN only receives the html/pdf and the source code. However, CRAN does not re-build the vignette. It only checks that the code is runnable (by running it). What happens when running the script on the user's configuration if the DB handle does not exist? Or indeed, when CRAN runs the code and no DB is built by running the code? This posting https://forum.posit.co/t/vignettes-that-require-locally-stored-data/2392 seems to come close to my question. Best Johannes 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 5. Landesqualit?tskonferenz Mittwoch 08. Oktober 2025 in M?nster 20 Jahre Krebsregistrierung f?r Nordrhein-Westfalen Eine Erfolgsgeschichte f?r die onkologische Forschung und Versorgung Anmeldung: https://www.landeskrebsregister.nrw/5-landesqualitaetskonferenz-nrw/ 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. [[alternative HTML version deleted]]
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
You can also pre-render your vignette on your local machine, where you have access to the database. Downside is that you cannot automate this, so you will have to render again when you update your package. See: https://ropensci.org/blog/2019/12/08/precompute-vignettes/#the-solution-locally-knitting-rmarkdown Pepijn ________________________________________ Van:?R-package-devel <r-package-devel-bounces at r-project.org> namens Duncan Murdoch <murdoch.duncan at gmail.com> Verzonden:?maandag 18 augustus 2025 16:55 Aan:?H?sing, Johannes <Johannes.Huesing at krebsregister.nrw.de>; r-package-devel at r-project.org <r-package-devel at r-project.org> Onderwerp:?Re: [R-pkg-devel] Drafting vignettes that require DB connection ? Presumably when your code tries to open the database, it will fail with an error.? What you should do is catch that error so the vignette doesn't fail, and print a message to the user explaining why things didn't work. If you are using knitr, you can call `knitr::knit_exit()` and it will quit at that point without appearing to fail. Duncan Murdoch
On 2025-08-18 9:06 a.m., H?sing, Johannes via R-package-devel wrote:
Disclaimer: I am building a package for local usage (for now), which will probably be not submitted to CRAN. If you view this posting as off topic, please say so or ignore. In a vignette like this one https://rdrr.io/cran/DBI/f/vignettes/DBI-advanced.Rmd, code is introduced that, on invocation, would try to establish a DB connection which probably would not exist on someone else's than the maintainer's configuration. Would the maintainer expect the user of the package to tweak her local configuration, or rather vignette script, to make the code run? The R packages book reads: Note that since you build vignettes locally, CRAN only receives the html/pdf and the source code. However, CRAN does not re-build the vignette. It only checks that the code is runnable (by running it). What happens when running the script on the user's configuration if the DB handle does not exist? Or indeed, when CRAN runs the code and no DB is built by running the code? This posting https://forum.posit.co/t/vignettes-that-require-locally-stored-data/2392?seems to come close to my question. Best Johannes 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> [http://www.landeskrebsregister.nrw<http://www.landeskrebsregister.nrw>]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 5. Landesqualit?tskonferenz Mittwoch 08. Oktober 2025 in M?nster 20 Jahre Krebsregistrierung f?r Nordrhein-Westfalen Eine Erfolgsgeschichte f?r die onkologische Forschung und Versorgung Anmeldung: https://www.landeskrebsregister.nrw/5-landesqualitaetskonferenz-nrw/ 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. ??????? [[alternative HTML version deleted]]
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel