View source: R/check_unused_objects_single_file.R
| check_unused_objects_single_file | R Documentation |
Parses an R script or an R/Quarto document, extracts the R code, and reports
symbols that are assigned to but never referenced anywhere else in the same file.
Supports .R, .Rmd, and .qmd (R code chunks only for the latter two).
check_unused_objects_single_file(path)
path |
Character. Path to a file. |
A data frame with one column, unused_objects, listing orphaned objects.
Returns an empty data frame if no orphans are found.
path <- tempfile(fileext = ".R")
writeLines(
c(
"df1 <- data.frame(x = 1:3)",
"df2 <- transform(df1, y = x * 2) # never used",
"print(df1)"
),
path
)
check_unused_objects_single_file(path)
unlink(path)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.