View source: R/updateBdatNamespace.R
updateBdatNamespace | R Documentation |
function replaces calls to package 'rBDATPRO' by calls to package 'rBDAT', simply by replacing the package name.
updateBdatNamespace(inpath = file.choose(), outpath = NULL)
inpath |
path of file to process |
outpath |
either a file name or a directory, both or NULL, see details. |
This function merely exists to account for the renaming of the
package from rBDATPRO
(which was internally used for some period of
time) to rBDAT
. Its sole purpose is to update R-scripts which use
rBDATPRO
and now should be updated to use rBDAT
. Internally,
gsub
is used.
outpath
can be (i) a filename, then the newly generated file
is stored under that name in the inpath
directory, (ii) a directory,
then the inpath
-filename is used with prefixed rbdat_
, (iii) a
complete path (directory name and file name), then this is used to store the
file, (iv) NULL, then the inpath is used with prefixed rbdat_
to the
inpath filename.
a character holding path and filename of the updated file
## Not run: p <- tempdir() f <- "rbdatpro.r" tx <- c("require(rBDATPRO)", "library(rBDATPRO)", "rBDATPRO::getDiameter(list(spp=1, D1=30, H=27))") pf <- file.path(p, f) writeLines(tx, con=pf) file.exists(pf) list.files(p) # file.show(pf) ## define different output specs outpath1 <- file.path(tempdir(), "devel/rbdatScript.r") outpath2 <- p outpath3 <- "rbdatScript.r" (updated_file <- updateBdatNamespace(pf, outpath = NULL)) list.files(p) # file.show(updated_file) (updated_file <- updateBdatNamespace(pf, outpath1)) list.files(file.path(p, "devel")) # file.show(updated_file) (updated_file <- updateBdatNamespace(pf, outpath2)) list.files(p) # file.show(updated_file) (updated_file <- updateBdatNamespace(pf, outpath3)) list.files(p) # file.show(updated_file) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.