[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> 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