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,
...
)
character, vector of path(s) to one or more .R files, a path to directory containing .R files, Default: NULL
logical, If TRUE overwrites file(s), FALSE writes "Oxy"- prefixed files in the same directory, Default: FALSE
logical, If TRUE will print output to console and open edited files in the editor viewer, Default: interactive()
boolean print output from each processed file to console. Default: FALSE
boolean to return roxygen2 skeleton with Markdown formatting, Default: FALSE
character, path to save new R files, Default: NULL
Arguments passed on to makeOxygen
add_default
boolean to add defaults values to the end of the PARAM fields, Default: TRUE
add_fields
character vector to add additional roxygen2 fields, Default: c("details","examples","seealso","rdname","export")
use_dictionary
character, path_to_dictionary, Default: NULL
use_labels
boolean to use label attribute of data frame columns to fill column description values. Ignored if obj is a function or vector. Default: FALSE.
scope
The scope of transformations: "simple"
runs only transformations
that shouldn't substantially change the resulting .Rd
files, "full"
runs
all transformations. In larger packages, run "none"
, double-check and track
the changes, and then run "simple"
and then "full"
.
Nothing. Writes files with roxygen2 comments as a side effect
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
.
# copy dummy package to tempdir
file.copy(system.file('pkg',package = 'sinew'),tempdir(),recursive = TRUE)
#> [1] 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)
#>
#> functions changed in '/tmp/Rtmp9MrrZZ/pkg/R/yy.R':
#>
#> ✔: found, ✖: not found, (): instances, ☒: user intervention
#>
#> ✔ utils::head (1)
#> ✔ stats::runif (1)
#>
#>
#> functions changed in '/tmp/Rtmp9MrrZZ/pkg/R/zz.R':
#>
#> ✔: found, ✖: not found, (): instances, ☒: user intervention
#>
#> ✔ utils::head (1)
#> ✔ stats::runif (1)
#>
# 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)
#> ! `dir.out` is ignored when `overwrite` is `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()