Hi @gaborcsardi
I was thinking it would be super handy if pak::pak() could also accept a plain multi-line string (in addition to a character vector with lots of quotes and commas). It makes copy-pasting and managing large lists of dependencies much easier.
Ideally, the function would ignore blank lines, trim spaces, and let us use # to comment out specific packages.
Here's a quick helper function I wrote to show what I mean:
parse_packages <- function(text) {
pkgs <- unlist(strsplit(text, "\n"))
pkgs <- trimws(pkgs)
pkgs <- pkgs[!grepl("^#", pkgs)]
pkgs <- pkgs[pkgs != ""]
return(pkgs)
}
Usage:
pak::pak(parse_packages("
# ...........................................
# Requirements
# ...........................................
dplyr
lme4
# ggplot2
tidyverse/tibble
"))
Would it make sense to support this natively in pak(), or include a small helper function like this to do the heavy lifting?
Hi @gaborcsardi
I was thinking it would be super handy if
pak::pak()could also accept a plain multi-line string (in addition to a character vector with lots of quotes and commas). It makes copy-pasting and managing large lists of dependencies much easier.Ideally, the function would ignore blank lines, trim spaces, and let us use
#to comment out specific packages.Here's a quick helper function I wrote to show what I mean:
Usage:
Would it make sense to support this natively in
pak(), or include a small helper function like this to do the heavy lifting?