This package allows you to parse your R scripts and to calculate some staticstics on your code.
Installation
For installing the latest release of this R package run the following code below:
# Enable repository from kwb-r
options(repos = c(
kwbr = 'https://kwb-r.r-universe.dev',
CRAN = 'https://cloud.r-project.org'))
# Download and install kwb.code in R
install.packages('kwb.code')
# Browse the kwb.code manual pages
help(package = 'kwb.code')
Basic Usage
If you have a lot of R scripts and you want to know what different packages are loaded from within your scripts, you may use the function get_names_of_used_packages
:
# Set path to directory in which to look recursively for R scripts
root_dir <- "~/Desktop/R-Development"
# Get the names of used packages
packages <- kwb.code::get_names_of_used_packages(root_dir)
# Show the names of the packages
packages