This R-function creates a .bib-file that includes the citations from all the packages that you have used in a project. The input can be a file or folder. The function will use all R-files and Rmd-files and extract the
You must specify
- the input
You can specify
- the output file location and name
- a vector of packagaes to exclude
citeR <- function(input, output, exclude)
install_package_if_missing <- function(pkg) {
if (! pkg %in% installed.packages()[, "Package"]) install.packages(pkg)
}
install_package_if_missing("tidyverse")
install_package_if_missing("purr")
First, you need to install the devtools package. You can do this from CRAN. Invoke R and then type
install.packages("devtools")
Load the devtools package.
library(devtools)
Usually you just use install_github("author/package") but it's not yet a package. Therefore, just do as follows
devtools::source_url(
"https://raw.githubusercontent.com/sebaristoteles/citeR/main/cite.R"
)