Open nanxstats opened 9 years ago
or try this one (also applies to require()
, ::
, etc.):
sub(".*library\\(\"(.*?)\"\\).*", "\\1", grep("library\\(", readLines("foo.Rmd"), value = TRUE))
Maybe an R function + an RStudio addin for this purpose using the above snippet.
Note to self: packrat:::fileDependencies
and packrat:::fileDependencies.Rmd
should be the right way to go.
Possibly using the source parse tree offered by lintr by @jimhester .
https://cran.r-project.org/web/packages/lintr/vignettes/creating_linters.html