Function to list all imported packages in a project
This commit is contained in:
@@ -3,3 +3,4 @@
|
|||||||
export(fetch_available_archives)
|
export(fetch_available_archives)
|
||||||
export(fetch_available_packages)
|
export(fetch_available_packages)
|
||||||
export(list_depends)
|
export(list_depends)
|
||||||
|
export(list_imports)
|
||||||
|
|||||||
17
R/list_imports.R
Normal file
17
R/list_imports.R
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
#' Find all the packages the current project directly includes and their
|
||||||
|
#' versions.
|
||||||
|
#'
|
||||||
|
#' @return A data frame with the directly required packages
|
||||||
|
#' @export
|
||||||
|
list_imports <- function() {
|
||||||
|
packages <- sort(unique(renv::dependencies(progress = FALSE)$Package))
|
||||||
|
all_packages <- installed.packages()
|
||||||
|
all_packages <- as.data.frame(all_packages)
|
||||||
|
all_packages <- all_packages[all_packages$Package %in% packages,]
|
||||||
|
packages <- data.frame(
|
||||||
|
package = all_packages$Package,
|
||||||
|
version = all_packages$Version
|
||||||
|
)
|
||||||
|
return(packages)
|
||||||
|
}
|
||||||
16
man/list_imports.Rd
Normal file
16
man/list_imports.Rd
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/list_imports.R
|
||||||
|
\name{list_imports}
|
||||||
|
\alias{list_imports}
|
||||||
|
\title{Find all the packages the current project directly includes and their
|
||||||
|
versions.}
|
||||||
|
\usage{
|
||||||
|
list_imports()
|
||||||
|
}
|
||||||
|
\value{
|
||||||
|
A data frame with the directly required packages
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Find all the packages the current project directly includes and their
|
||||||
|
versions.
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user