p_extract: Convert String With Commas Into Elements

Description Usage Arguments Value See Also Examples

View source: R/p_extract.R

Description

p_extract is designed to be used in conjunction with p_information to convert a single comma separated string into a vector of package names.

Usage

1
p_extract(x, use.names = TRUE)

Arguments

x

A character string of packages separated by commas; for example the strings returned from p_information.

use.names

logical. If TRUE package names, including version number, are used.

Value

Returns a character vector of packages.

See Also

p_information

Examples

1
2
3
4
5
6
## Not run: 
p_extract(p_info(ggplot2, "Depends"))
p_extract(p_info(ggplot2, "Imports"))
lapply(p_info(ggplot2, "Imports", "Depends", "Suggests"), p_extract)

## End(Not run)

Example output

R (>= 3.1) 
       "R" 
           digest              grid gtable (>= 0.1.1)          lazyeval 
         "digest"            "grid"          "gtable"        "lazyeval" 
             MASS              mgcv   plyr (>= 1.7.1)          reshape2 
           "MASS"            "mgcv"            "plyr"        "reshape2" 
 rlang (>= 0.2.1) scales (>= 0.5.0)             stats            tibble 
          "rlang"          "scales"           "stats"          "tibble" 
      viridisLite  withr (>= 2.0.0) 
    "viridisLite"           "withr" 
$Depends
R (>= 3.1) 
       "R" 

$Imports
           digest              grid gtable (>= 0.1.1)          lazyeval 
         "digest"            "grid"          "gtable"        "lazyeval" 
             MASS              mgcv   plyr (>= 1.7.1)          reshape2 
           "MASS"            "mgcv"            "plyr"        "reshape2" 
 rlang (>= 0.2.1) scales (>= 0.5.0)             stats            tibble 
          "rlang"          "scales"           "stats"          "tibble" 
      viridisLite  withr (>= 2.0.0) 
    "viridisLite"           "withr" 

$Suggests
                   covr                   dplyr           ggplot2movies 
                 "covr"                 "dplyr"         "ggplot2movies" 
                 hexbin                   Hmisc                 lattice 
               "hexbin"                 "Hmisc"               "lattice" 
                mapproj                    maps                maptools 
              "mapproj"                  "maps"              "maptools" 
               multcomp                 munsell                    nlme 
             "multcomp"               "munsell"                  "nlme" 
   testthat (>= 0.11.0)                  vdiffr                quantreg 
             "testthat"                "vdiffr"              "quantreg" 
                  knitr                   rgeos                   rpart 
                "knitr"                 "rgeos"                 "rpart" 
              rmarkdown           sf (>= 0.3-4) svglite (>= 1.2.0.9001) 
            "rmarkdown"                    "sf"               "svglite" 

pacman documentation built on May 2, 2019, 1:08 p.m.