The roxygen2 package makes it possible to write documentation for R functions directly above the corresponding function. This function can be used to update the parameter list of a documentation string (docstring) of a valid function of a valid R file. The update is done by comparing the currently listed parameters with the actual function parameters. Outdated parameters are removed and missing parameters are added to the docstring.
Examples
uri <- system.file("testfiles/funcs.R", package = "toscutil")
func <- "f4"
update_docstring(uri, func)
#> [1] "#' @title TODO (e.g. 'Sum of Vector Elements')\n#' @description TODO (e.g. 'sum returns the sum of all the values present in its arguments.'\n#' @param a TODO\n#' @param b TODO\n#' @param x TODO\n#' @param ... TODO\n"