make_import | R Documentation |
Scrape R
script to create import and importFrom calls for
roxygen2, namespace or description files
make_import( script, cut = NULL, print = TRUE, format = "oxygen", desc_loc = NULL )
script |
character, connection to pass to readLines, can be file path, directory path, url path |
cut |
integer, number of functions to write as importFrom until switches to import, Default: NULL |
print |
boolean, print output to console, Default: TRUE |
format |
character, the output format must be in c('oxygen','description','import'), Default: 'oxygen' |
desc_loc |
character, path to DESCRIPTION file, if not NULL then the Imports fields in the DESCRIPTION file, Default: NULL |
# copy dummy package to tempdir file.copy(system.file('pkg',package = 'sinew'),tempdir(),recursive = TRUE) pkg_dir <- file.path(tempdir(),'pkg') pkg_dir_R <- file.path(pkg_dir,'R') pkg_dir_DESC <- file.path(pkg_dir,'DESCRIPTION') # update namespaces in package functions pretty_namespace(pkg_dir_R, overwrite = TRUE) # update imports/importsFrom for roxygen2 tags make_import(pkg_dir_R,format = 'oxygen') # update Imports for DESCRIPTION file output to console make_import(pkg_dir_R,format = 'description') # update Imports for DESCRIPTION file overwrite file make_import(pkg_dir_R,format = 'description', desc_loc = pkg_dir) cat(readLines(pkg_dir_DESC),sep = '\n') # cleanup tempdir unlink(pkg_dir, force = TRUE, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.