Browse Source

List and print packages

master
Maxime Wack 3 years ago
parent
commit
893c2eb7da
1 changed files with 41 additions and 0 deletions
  1. +41
    -0
      functions.Rmd

+ 41
- 0
functions.Rmd View File

@@ -1,3 +1,44 @@
---
title: R object browser functions
---

# Description

## Print

### Package

```{r print package}
##' Print a package
##'
##' Display the fullname of the package,
##' the type, and the name with the size.
##' @title Print a package
##' @param pkg The package to print
##' @return The line to print to the buffer
print_package <- function(pkg)
{
paste0(pkg,
"|pkg| ",
pkg)
}
```

# List objects

## Packages

### List packages

```{r list packages}
##' List packages
##'
##' List all the installed packages
##' @title List packages
##' @return A character vector of packages
list_packages <- function()
sapply(row.names(installed.packages()),
print_package,
USE.NAMES = F,
simplify = T)
```

Loading…
Cancel
Save