A Quick Example of How We Can Share our Output

This has been produced as an R Markdown document to show an example of how to quickly and easily publish our results on the internet.

When you click the Knit HTML button in on a Markdown document in RStudio a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. We can therefore embed an R code chunk like this (suppressing some of the output R produces) :

##      Wheat          Wbarley          Sbarley         Tbarley      
##  Min.   :  6.6   Min.   :  2.63   Min.   :  0.0   Min.   :  4.71  
##  1st Qu.:104.9   1st Qu.: 41.06   1st Qu.: 11.5   1st Qu.: 57.75  
##  Median :198.5   Median : 74.01   Median : 19.8   Median :104.25  
##  Mean   :239.5   Mean   : 87.60   Mean   : 27.6   Mean   :115.20  
##  3rd Qu.:372.5   3rd Qu.:119.76   3rd Qu.: 43.2   3rd Qu.:165.78  
##  Max.   :696.1   Max.   :242.66   Max.   :101.9   Max.   :291.16

We can make tables cleaner using xtable:

Wheat Wbarley Sbarley Tbarley Oats
423.77 110.61 101.90 212.51 29.96
198.52 75.22 62.16 137.38 36.89
511.51 114.05 65.01 179.06 22.17
202.68 36.34 56.12 92.46 68.75
234.21 47.43 46.18 93.61 8.82
375.60 113.50 80.09 193.60 40.68
124.54 72.33 23.90 96.23 22.74
27.86 26.08 7.77 33.85 4.53
8.27 14.27 3.28 17.55 1.96
257.57 151.62 49.85 201.47 34.83

We can also embed graphs or maps, for example:

spplot(pcdata, "TotalCattle", main = "Cattle", col.regions = mypalette, cuts = 9)

plot of chunk unnamed-chunk-3

We can even animate, here's an example gif!!

image

This could be an easy way for sharing our work with external collegues and making sure that the latest version is being used/consulted.