libr_unused {nolock} | R Documentation |
'Get Unused Packages in the Active 'R' Script'
Description
Retrieves a vector of package names that are called within an 'R' script but are never actually used in the script.
Usage
libr_unused(script = NULL)
Arguments
script |
Character vector. 'R' script to be processed. If NULL, an active 'R' script is used. |
Value
Retrieves a vector of package names which are never really used in the code.
Examples
script_content <- 'library(rstudioapi)
ActiveDocument <- getActiveDocumentContext()$path
min_c <- min(c(1,2,3))
require(dplyr)
pacman::p_load(tidymodels)'
temp_script_path <- tempfile(fileext = ".R")
writeLines(script_content, con = temp_script_path)
libr_unused(script = temp_script_path)
unlink(temp_script_path)
[Package nolock version 1.1.0 Index]