Update/append an R file that has roxygen2 headers already with updated information
moga(path, ..., force.fields = NULL, dry.run = TRUE, overwrite = FALSE)
character path to R file
arguments to be passed to new makeOxygen
character, vector a field names that are in current header that are to be updated Default: NULL
boolean, write lines to console the output, Default: TRUE
boolean, overwrite contents of input file, Default: FALSE
character
Cross references fields already in the roxygen2 header and adds any new ones from the updated call. To force a change to a field add field name to force.fields.
# We want to update the contents of the Roxygen2 with the new parameter "b"
# without touching the other fields
# Before
cat(readLines(system.file('example_moga.R',package = 'sinew')),sep = '\n')
#> #' @title FUNCTION_TITLE
#> #' @description FUNCTION_DESCRIPTION
#> #' @param a numeric, set the head to trim from random unif Default: 4
#> #' @return OUTPUT_DESCRIPTION
#> #' @details DETAILS
#> #' @examples
#> #' \\dontrun{
#> #' if(interactive()){
#> #' #EXAMPLE1
#> #' }
#> #' }
#> #' @seealso
#> #' \\code{\\link[utils]{head}}
#> #' \\code{\\link[stats]{runif}}
#> #' @rdname yy
#> #' @export
#> #' @author Jonathan Sidi
#> #' @importFrom utils head
#> #' @importFrom stats runif
#> yy <- function(a=4,b=2){
#> x <- utils::head(stats::runif(10*b),a)
#> stats::quantile(x,probs=.95)
#> # a comment
#> }
# After
moga(system.file('example_moga.R',package = 'sinew'))
#> #' @title FUNCTION_TITLE
#> #' @description FUNCTION_DESCRIPTION
#> #' @param a numeric, set the head to trim from random unif Default: 4
#> #' @param b PARAM_DESCRIPTION, Default: 2
#> #' @return OUTPUT_DESCRIPTION
#> #' @details DETAILS
#> #' @examples
#> #' \\dontrun{
#> #' if(interactive()){
#> #' #EXAMPLE1
#> #' }
#> #' }
#> #' @seealso
#> #' \\code{\\link[utils]{head}}
#> #' \\code{\\link[stats]{runif}}
#> #' @rdname yy
#> #' @export
#> #' @author Jonathan Sidi
#> #' @importFrom utils head
#> #' @importFrom stats runif
#> #' @returns OUTPUT_DESCRIPTION