Skip to content

Transform Google R style guide function documentations to roxygen2 style.

License

Notifications You must be signed in to change notification settings

jukujala/r-google-style-to-roxygen2

Repository files navigation

R Google style to roxygen2 style

roxygen2 makes it easy to generate documentation for R packages. Code in this repo just transforms function documentation part of Google R style to roxygen2 format.

Example input/output

Input (part of file):

fun <- function(x, y) {
    # Add together two numbers
    #
    # Args:
    #   x: A number
    #   y: A number
    #
    # Returns:
    #   The sum of x and y
    x+y
}

Output:

#' Add together two numbers
#' @export
#'
#' @param x: A number
#' @param y: A number
#'
#' @return The sum of x and y
fun <- function(x, y) {
    x+y
}

Usage

git clone https://github.com/jukujala/r-google-style-to-roxygen2.git
cd r-google-style-to-roxygen2/
./run_transform_comments.sh -i my_file.r
# prints to stdout

Feedback

Feel free to report bugs to my email given at github page. Tell also if there is a better way to do the transformation, the current state machine logic feels too complicated.

Status of this software

This is just something I quickly wrote, so do not expect it to work well ;)

About

Transform Google R style guide function documentations to roxygen2 style.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published