Function commenting conventions in R

后端 未结 3 1376
不知归路
不知归路 2020-12-14 08:03

I\'m fairly new to R, and I have been defining some of my own functions in script files. I\'m intending for others to re-use them later, and I can\'t find any guides on R fu

3条回答
  •  孤城傲影
    2020-12-14 08:37

    Updating this question December 2019 as the R-universe has changed since 2011 when originally written

    My recommended resource is now http://r-pkgs.had.co.nz/

    Original answer (links are mostly out of date)

    The canonical way to document your functions and make them accessible to others is to make a package. In order for your package to pass the build checks, you have to supply sufficiently detailed help files for each of your functions / datasets.

    Check out http://cran.r-project.org/doc/manuals/R-exts.html#Creating-R-packages

    This blog post from Rob J Hyndman was very useful and one of the easiest for me to follow: http://robjhyndman.com/researchtips/building-r-packages-for-windows/

    I've started using roxygen to assist in making & compiling packages as of late: http://roxygen.org/

    Lots of good resources and people to help when you have questions!

提交回复
热议问题