Thanks for creating and maintaining this package.
I was thinking it would be super handy if Require() could accept a plain multi-line string instead of 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:
Require(parse_packages("
# ...........................................
# Requirements
# ...........................................
dplyr
lme4
# ggplot2
PredictiveEcology/LandR@development
"))
Would it make sense to support this natively in Require(), or include a small helper function like this to do the heavy lifting?
Thanks for creating and maintaining this package.
I was thinking it would be super handy if
Require()could accept a plain multi-line string instead of 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
Require(), or include a small helper function like this to do the heavy lifting?