Introduction

This is my first Rmarkdown document!

Let’s do more here!

Here’s some bold text.

library(dplyr)
library(readr)
library(ggplot2)
library(knitr)
gm <- read_csv("data/gapminder.csv")
## Parsed with column specification:
## cols(
##   country = col_character(),
##   continent = col_character(),
##   year = col_integer(),
##   lifeExp = col_double(),
##   pop = col_integer(),
##   gdpPercap = col_double()
## )
head(gm)
## # A tibble: 6 x 6
##       country continent  year lifeExp      pop gdpPercap
##         <chr>     <chr> <int>   <dbl>    <int>     <dbl>
## 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
mean(gm$lifeExp)
sd(gm$gdpPercap)
unique(gm$year)
## [1] 59.47444
## [1] 9857.455
##  [1] 1952 1957 1962 1967 1972 1977 1982 1987 1992 1997 2002 2007

Tables

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

Now we’re out of the R code chunk.

The mean life expectancy is 59.4744394. This is just fixed width.

ggplot(gm, aes(gdpPercap, lifeExp)) + geom_point() + scale_x_log10()
Life Expectancy vs GDP Per Capita

Life Expectancy vs GDP Per Capita

Session Information

Hooray reproducibility!

sessionInfo()
## R version 3.4.2 (2017-09-28)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS Sierra 10.12.6
## 
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
## 
## 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] knitr_1.17    ggplot2_2.2.1 readr_1.1.1   dplyr_0.7.4  
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_0.12.13     bindr_0.1        magrittr_1.5     hms_0.3         
##  [5] munsell_0.4.3    colorspace_1.3-2 R6_2.2.2         rlang_0.1.2     
##  [9] highr_0.6        plyr_1.8.4       stringr_1.2.0    tools_3.4.2     
## [13] grid_3.4.2       gtable_0.2.0     htmltools_0.3.6  lazyeval_0.2.0  
## [17] yaml_2.1.14      assertthat_0.2.0 rprojroot_1.2    digest_0.6.12   
## [21] tibble_1.3.4     bindrcpp_0.2     glue_1.1.1       evaluate_0.10.1 
## [25] rmarkdown_1.6    labeling_0.3     stringi_1.1.5    compiler_3.4.2  
## [29] scales_0.5.0     backports_1.1.1  pkgconfig_2.0.1