Skip to content
R scripts with templates and examples of analyses using knitr with Rmarkdown or LaTeX
HTML R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md README.md: updated to reflect that getRs and knitrSet are now in Hmisc Sep 2, 2015
abd17-1.Rmd added journal references for data sources, improved graph cosmetics May 16, 2015
abd17-1.html added journal references for data sources, improved graph cosmetics May 16, 2015
abd17-20.Rmd added journal references for data sources, improved graph cosmetics May 16, 2015
abd17-20.html added journal references for data sources, improved graph cosmetics May 16, 2015
abd17-28.Rmd added journal references for data sources, improved graph cosmetics May 16, 2015
abd17-28.html added journal references for data sources, improved graph cosmetics May 16, 2015
abd18-11.Rmd abd18-11: new script May 22, 2015
abd18-11.html abd18-11: new script May 22, 2015
abd18-18.Rmd added contrast examples May 22, 2015
abd18-18.html added contrast examples May 22, 2015
catgNoise.r createContents.r: automatically construct contents.md from script hea… Apr 3, 2015
contents.md new contents Jan 11, 2016
createContents.r
demoLeastSquares.r change to traditional line key, used gray scale for residuals from ols Jan 22, 2016
demoOLSqr.r moved curve fitting to a minor category of regression modeling Apr 6, 2015
demoSpline.r demoSpline.r: fixed bug Jan 18, 2016
descriptives.Rmd descriptives: corrected old file='' for html Sep 8, 2019
descriptives.html descriptives: corrected old file='' for html Sep 8, 2019
graphicsSet.r graphicsSet: new script to define graphics utility functions Apr 26, 2015
importREDCap.r
introda.r added headers for all scripts Apr 2, 2015
lead-ols.Rmd lead-ols: incorporated new html methods Apr 18, 2017
lead-ols.html lead-ols: incorporated new html methods Apr 18, 2017
observerVariability.r
observerVariability_example.r observerVariability: demo script Jan 27, 2020
r2stata.r
rcsbplot-1.png png file Sep 8, 2019
revaliases
rms2-5.Rmd fixed category Jun 2, 2015
rms2-5.html
rms2-fev.Rmd
rms2-fev.html rms2-fev: fixed plotly calls Sep 8, 2019
sim-continuous-ordinal.r simulation code from Yuqi Tian for ordinal analysis of continuous Y Oct 16, 2019
ssmtp.conf
ssmtp.r ssmtp: added checkSsmtp function Sep 23, 2019

README.md

rscripts

R Scripts: Templates, Examples of Analyses using knitr with Rmarkdown or LaTeX, Interactive RStudio Demonstrations | Contents Directory

This is for use with the R function getRs in the R Hmisc package for listing available scripts, downloading a selected script, and opening it in the RStudio script editor window.

The special file contents.md lists all the available files and short descriptions for them. It should not be edited, as it is auto-generated by createContents.r. contents.md is used when getRs is called with no arguments, to give the user a list of available scripts and their descriptions.

The Rmarkdown scripts included here use a template that makes the result part of a reproducible research process by documenting the versions of R and attached packages at the end of the report. They make use of the Hmisc package's knitrSet function. When running Rmarkdown, call knitrSet(lang='markdown'). knitrSet gets rid of ## at the start of R output lines, and makes it easy to specify things like figure sizes in knitr chunk headers. It also causes annoying messages such as those generated from attaching R packages to be put in a separate file messages.txt rather than in the report.

contents.md is generated from titles, major and minor categories, and types (R, R Markdown) that are at the top of each script. R Markdown scripts must have suffix Rmd and have the following information between lines containing --- and after the output: section: major, and minor (optional). Scripts that fall under multiple categories have those category descriptions separated by semicolons. See descriptives.Rmd for an example. Regular R scripts must have suffix r and have the following in the top lines of the script (again, minor is optional):

# title: Title of Script with Purpose, etc.
# major: major category 1; major category 2 ...
# minor: minor category 1; minor category 2 ...

See introda.r for an example.

Some possible values for major categories are listed below.

Major Category Comments
curve fitting
descriptive statistics
graphics
statistical pitfalls
introduction Introduction to R
regression modeling
statistical tests
ABD Problems from Analysis of Biological Data, 2nd edition, by Whitlock and Schluter

Some possible values for minor categories are listed below.

Minor Category Comments
ordinary least squares Linear Model
unadjusted comparisons
categorization

To request the addition of new categories open an issue for this GitHub project.

You can’t perform that action at this time.