update_docstring: Update docstring for a Function

View source: R/doc.R

update_docstringR Documentation

Update docstring for a Function

Description

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.

Usage

update_docstring(uri, func, content = NULL)

Arguments

uri

Path to R file.

func

Function name. If a function is defined multiple times inside the provided file, only the last occurence will be considered.

content

R code as string. If provided, uri is ignored.

Value

A character vector of length 1 containing the updated docstring.

Examples

uri <- system.file("testfiles/funcs.R", package = "toscutil")
func <- "f4"
update_docstring(uri, func)

toscm/toscutil documentation built on Feb. 23, 2025, 2:20 p.m.