loading libraries in rmarkdown best practice (continued)

Hi

This I put as 'continued' because the old thread:
https://forum.posit.co/t/best-practices-for-location-of-library-in-rmd-files/2302/19
is the same subject but does not quite cover the case I'm asking about.

My rmarkdown output is html , creating a website using blogdown. I load the libraries at the top of each Rmd page by sourcing a script where they are listed. So when I end up with say 30 Rmd pages, that is loading the libraries 30 times whenever I build the site (which I appreciate I don't have to every time I update a file, but I do it regularly). As far as I have been able to work out there is no alternative to this - but I wonder if I am missing something obvious? Many thanks

If I had 30 Rmd files to generate and a large number of libraries and large data and memory intensive operations such that separately loading libraries in each Rmd were an issue, I'd bite the bullet and write the Rmd content to bring in library resources on an as-needed basis only

lubridate:ydm("2020--05-06")

or use {box} or write a custom package bringing into namespace library functions individually.

Thank you, I'll look at {box}

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.