Coding Standards in R
There a couple of basic, minimal standards to adhere to.
- A text format.
- Indent your code.
- Limit the width of your code.
- Limit the size of functions.
Markdown
Text to HTML conversion tool.
Advanced Linking:
then in a central spot you can put:
[1]: http://google.com "Some Link"
[2]: http://theage.com.au "Another Link"
Newlines require a double space and the end of the line.
One Line Two Lines
One Line
Two Lines
R Markdown
R code integrated with the markdown language. R code is evaluated as part of the processing of the markdown. Core tool in literate statistical programming.
- R markdown converted to standard markdown using the
knitr
package. - Markdown can be converted to HTML using the
markdown
package`. - Create slides using the
slidify
package.
How To Make Work Reproducible
- Decide to do it from the start.
- Use version control.
- Don’t save output - generate it.
- Save data in non-proprietary formats.
knitr
- R package
- Supports RMarkdown, LaTeX, and HTML as documentation languages.
- Can export to PDF, HTML.
- Built right into RStudio.