Hi,
I was wondering what people do with their packages? At the moment, I have a markdown document, and an entire chunk called 'packages'.
A small part of it looks like the below (as an example)
options(repos="https://cran.rstudio.com" )
if (!require("ggstatsplot")) install.packages("ggstatsplot")
library(ggstatsplot)
if (!require("Hmisc")) install.packages("Hmisc")
library(Hmisc)
Each time I knit, all the packages are installed, and loaded. I guess my questions are:
- Does markdown have to install + load all packages each time? This takes a while
- Is there a way to check which I've used? I'm sure I have more packages in the chunk than I need, but other than deleting each individually and seeing if it affects my analysis, I'm not sure what to do.
- I was trying to use bookdown, but I had some trouble with it (will use when I don't have a deadline)! I don't really understand how packages work in bookdown, is it best to put them all in index, and none in subsequent chapters? I've also seen some save them as .bib files in there (though maybe this is just the reference to the package, rather than a list of all the packages).
Thanks for your help