I have recently started using RStudio (2022.02.0) and specifically R Markdown. However, I can not figure out the following: In which file is the information stored about which packages should be loaded? I imagine there needs to be a file similar to nodes package.json
. I could not make out any file in the project folder, hidden or not, that contained the required packages. I never bothered about this before because it never caused a problem. However, I would now like to explicitly specify every package I need in the markdown document via library()
and remove all ambiguity about package inclusion (it's for a uni project).
More specifically, I am talking about this r markdown code:
---
title: "RMarkdown test"
output: html_notebook
---
```{r}
plot(cars)
```
This code works and plots the dataframe cars
from the datasets
package using the function plot
from the graphics
package. However, the only way I can see which package is loaded is via the "Packages" tab in RStudio. The code itself does not make any of that explicit.
Now my specific questions:
- Where is the information about required packages stored?
- Can I somehow deactivate all "implicit" usage of packages and make r throw an error if a package is not explicitly loaded within the file itself via
library()
?
I know that this question might seem trivial to you, but I could just not find an answer on stackoverflow, google, the R docs, or anywhere else.