makeOxyFile | R Documentation |
Applies makeOxygen
function to all functions/dataframes in supplied file(s)
makeOxyFile(
input = NULL,
overwrite = FALSE,
verbose = interactive(),
print = FALSE,
markdown = FALSE,
dir.out = NULL,
...
)
make_oxy_file(
input = NULL,
overwrite = FALSE,
verbose = interactive(),
print = FALSE,
markdown = FALSE,
dir.out = NULL,
...
)
input |
character, vector of path(s) to one or more .R files, a path to directory containing .R files, Default: NULL |
overwrite |
logical, If TRUE overwrites file(s), FALSE writes "Oxy"- prefixed files in the same directory, Default: FALSE |
verbose |
logical, If TRUE will print output to console and open edited files in the editor viewer, Default: interactive() |
print |
boolean print output from each processed file to console. Default: FALSE |
markdown |
boolean to return roxygen2 skeleton with Markdown formatting, Default: FALSE |
dir.out |
character, path to save new R files, Default: NULL |
... |
Arguments passed on to
|
If an object cannot be found it will be sourced into a temporary environment.
If the file already contains roxygen2 comments they will be deleted to avoid duplication.
Some functions may require attaching additional packages. For instance, if functions
were defined with purrr's compose
or partial
functions, omission of purr::
in definitions will
require library(purrr)
before proceeding with makeOxyFile
.
Nothing. Writes files with roxygen2 comments as a side effect
Anton Grishin
makeOxygen
# 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')
# update namespaces in package functions
pretty_namespace(pkg_dir_R, overwrite = TRUE)
# test on one R file
# this will create a new R file called 'oxy-yy.R' in the same directory
makeOxyFile(file.path(pkg_dir_R,'yy.R'))
# Remove the file
unlink(file.path(pkg_dir_R,'oxy-yy.R'))
# Test on all R files in directory and overwrite the contents
makeOxyFile(pkg_dir_R, overwrite = TRUE)
# Remove Skeleton
rmOxygen(file.path(pkg_dir_R,'yy.R'))
rmOxygen(file.path(pkg_dir_R,'zz.R'))
# adds more fields to defaults, passes "cut" to make_import
sinew_opts$append(list(add_fields=c("concept", "describeIn")))
makeOxyFile(file.path(pkg_dir_R,'yy.R'), cut = 5)
# cleanup
unlink(pkg_dir, recursive = TRUE, force = TRUE)
sinew_opts$restore()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.