Hi I'm using R and R studio. Is there a way I can have my R markdown file list all the packages and their respected versions at the end of the documents? thanks! For example,
---
title: "test"
output: pdf_document
---
## R Markdown
```{r cars}
library(ggplot2)
library(gplots)
summary(cars)
```
You can get the names of loaded non-base packages with names(sessionInfo()$otherPkgs)
, so maybe something like this:
---
title: "test"
output: pdf_document
---
## R Markdown
```{r}
library(ggplot2)
library(data.table)
summary(cars)
```
```{r}
installed.packages()[names(sessionInfo()$otherPkgs), "Version"]
```
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With