Rd2roxygen (version 1.7)

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, ...)

Arguments

path

the path of the Rd file

...

other arguments passed to tidy_source

Value

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

See Also

tidy_source

Examples

Run this code
# NOT RUN {
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 DataCamp Workspace