Learn R Programming

Rd2roxygen (version 1.16)

reformat_code: Format the code in the usage and examples sections

Description

The function tidy_source in the formatR package is used to polish the Rd files generated by roxygen2 in the usage and examples sections.

Usage

reformat_code(path, ...)

Value

NULL; as a side effect, the original Rd file will be updated

Arguments

path

the path of the Rd file

...

other arguments passed to tidy_source

Author

Yihui Xie <http://yihui.org>

See Also

tidy_source

Examples

Run this code
rd.file = system.file("examples", "reformat_code_demo.Rd", package = "Rd2roxygen")
file.copy(rd.file, tempdir())
fmt.file = file.path(tempdir(), "reformat_code_demo.Rd")

file.show(fmt.file)  ## show the raw Rd

reformat_code(fmt.file)
file.show(fmt.file)  ## the formatted Rd

Run the code above in your browser using DataLab