liftr icon indicating copy to clipboard operation
liftr copied to clipboard

Extract package names from Rmd source and write to configuration file

Open nanxstats opened this issue 10 years ago • 3 comments

Possibly using the source parse tree offered by lintr by @jimhester .

https://cran.r-project.org/web/packages/lintr/vignettes/creating_linters.html

nanxstats avatar Jul 20 '15 22:07 nanxstats

or try this one (also applies to require(), ::, etc.):

sub(".*library\\(\"(.*?)\"\\).*", "\\1", grep("library\\(", readLines("foo.Rmd"), value = TRUE))

nanxstats avatar Apr 11 '17 11:04 nanxstats

Maybe an R function + an RStudio addin for this purpose using the above snippet.

nanxstats avatar Apr 11 '17 23:04 nanxstats

Note to self: packrat:::fileDependencies and packrat:::fileDependencies.Rmd should be the right way to go.

nanxstats avatar Mar 20 '18 19:03 nanxstats