The use of install_github() from the devtools package allows quick cross platform package building and installation. Documenting all functions correctly is quite tedious, so this quick test package has minimal documentation. However this looks like a useful way of providing functions for use on courses.

The printr package allows help files to be printed in a compiled document, among other things. Looks very useful. http://yihui.name/printr/

So install this first from the yihui github repository.

library(devtools)
install_github("yihui/printr")
library(printr)

Now install my little test package “qecol”.

install_github("dgolicher/qecol")
## Downloading github repo dgolicher/qecol@master
## Installing qecol
## '/usr/lib/R/bin/R' --vanilla CMD INSTALL  \
##   '/tmp/RtmpMXfs23/devtools6ff08e15fc1/dgolicher-qecol-07a4ad4'  \
##   --library='/home/duncan/R/x86_64-pc-linux-gnu-library/3.1'  \
##   --install-tests
library(qecol)
data(mussels)
head(mussels)
Lshell BTVolume Site
122.1 39 Site_6
100.1 21 Site_6
100.7 23 Site_6
102.3 22 Site_6
94.9 20 Site_6
116.9 22 Site_6

Test the help file for the little function.

?q_regres
q_regres R Documentation

Quickly run a regression with one command.

Description

Quickly run a regression with one command.

Usage

q_regres(x, y, xlab, ylab)

Arguments

x

Numerical vector.

y

A Numerical vector.

xlab

Label for x axis.

ylab

Label for y axis.

Value

Runs a quick regression and prints the results to a markdown report.

Examples

data(mussels)
q_regres(mussels$Lshell,mussels$BTVolume,"Shell length","Body volume")

Run the function

q_regres(mussels$Lshell,mussels$BTVolume,"Shell length","Body volume")
## Loading required package: ggplot2

## 
## Call:
## lm(formula = y ~ x)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -11.828  -2.672   0.147   2.235  17.404 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -36.02385    3.33917  -10.79   <2e-16 ***
## x             0.59754    0.03096   19.30   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 4.864 on 111 degrees of freedom
## Multiple R-squared:  0.7704, Adjusted R-squared:  0.7684 
## F-statistic: 372.5 on 1 and 111 DF,  p-value: < 2.2e-16
## 
##                   2.5 %      97.5 %
## (Intercept) -42.6406346 -29.4070662
## x             0.5361881   0.6588891