This is my first RMarkdown document! Let’s try some formatting - italics, bold, etc.
Let’s load the Gapminder data from http://bioconnector.org/data.
gm <- read.csv("data/gapminder.csv")
head(gm)
## country continent year lifeExp pop gdpPercap
## 1 Afghanistan Asia 1952 28.801 8425333 779.4453
## 2 Afghanistan Asia 1957 30.332 9240934 820.8530
## 3 Afghanistan Asia 1962 31.997 10267083 853.1007
## 4 Afghanistan Asia 1967 34.020 11537966 836.1971
## 5 Afghanistan Asia 1972 36.088 13079460 739.9811
## 6 Afghanistan Asia 1977 38.438 14880372 786.1134
library(knitr)
kable(head(gm))
| country | continent | year | lifeExp | pop | gdpPercap |
|---|---|---|---|---|---|
| Afghanistan | Asia | 1952 | 28.801 | 8425333 | 779.4453 |
| Afghanistan | Asia | 1957 | 30.332 | 9240934 | 820.8530 |
| Afghanistan | Asia | 1962 | 31.997 | 10267083 | 853.1007 |
| Afghanistan | Asia | 1967 | 34.020 | 11537966 | 836.1971 |
| Afghanistan | Asia | 1972 | 36.088 | 13079460 | 739.9811 |
| Afghanistan | Asia | 1977 | 38.438 | 14880372 | 786.1134 |
The mean life expectancy is 59.4744394.
The years surveyed include: 1952, 1957, 1962, 1967, 1972, 1977, 1982, 1987, 1992, 1997, 2002, 2007.
library(ggplot2)
ggplot(gm, aes(gdpPercap, lifeExp)) +
geom_point() + scale_x_log10() + aes(col=continent) +
theme_bw() + ggtitle("Plot title") +
geom_smooth(se=FALSE, lwd=3)
## geom_smooth: method="auto" and size of largest group is <1000, so using loess. Use 'method = x' to change the smoothing method.
Whatever I want the figure caption to be.
Here is some information about my R session.
sessionInfo()
## R version 3.2.2 (2015-08-14)
## Platform: x86_64-apple-darwin13.4.0 (64-bit)
## Running under: OS X 10.10.5 (Yosemite)
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] ggplot2_1.0.1 knitr_1.11
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0.12.2 digest_0.6.8 MASS_7.3-45 grid_3.2.2
## [5] plyr_1.8.3 gtable_0.1.2 formatR_1.2.1 magrittr_1.5
## [9] scales_0.3.0 evaluate_0.8 highr_0.5.1 stringi_1.0-1
## [13] reshape2_1.4.1 rmarkdown_0.8.1 labeling_0.3 proto_0.3-10
## [17] tools_3.2.2 stringr_1.0.0 munsell_0.4.2 yaml_2.1.13
## [21] colorspace_1.2-6 htmltools_0.2.6