options(htmltools.dir.version = FALSE) # see: https://github.com/yihui/xaringan # install.packages("xaringan") # see: # https://github.com/yihui/xaringan/wiki # https://github.com/gnab/remark/wiki/Markdown options(width=110) options(digits = 4)
From Wikipedia (emphasis added):
R is an open source programming language and software environment for statistical computing and graphics that is supported by the R Foundation for Statistical Computing. The R language is widely used among statisticians and data miners for developing statistical software and data analysis. Polls, surveys of data miners, and studies of scholarly literature databases show that R's popularity has increased substantially in recent years.
R is a GNU package. The source code for the R software environment is written primarily in C, Fortran, and R. R is freely available under the GNU General Public License, and pre-compiled binary versions are provided for various operating systems. While R has a command line interface, there are several graphical front-ends available.
From Wikipedia (emphasis added):
A programming language is a formal language that specifies a set of instructions that can be used to produce various kinds of output. Programming languages generally consist of instructions for a computer. Programming languages can be used to create programs that implement specific algorithms.
.pull-left4[
.pull-right4[
data <- read.table('my_data.txt') variables <- data[,c('group','variable')] analysis <- lm(variable ~ group, data = variables) summary(analysis)
]
R has been build for statistical computing and graphics and that is basically it:
.pull-left4[
.pull-right4[
R steadily grows in popularity. Today, R is one of the most popular languages for data science and overall. In terms of the number of data science jobs, R beats SAS and Matlab, and is on par with Python:
knitr::include_graphics("https://i0.wp.com/r4stats.com/wp-content/uploads/2017/02/Fig-1a-IndeedJobs-2017.png")
source: https://i0.wp.com/r4stats.com/
---
# R is so popular because
R has been implemented in **C, Fortran, and R**. This means that R can be fast and efficient, however, often it is not. R's strengths lie in its flexibility, cutting-edge development, and producitivity tools.
.pull-left5[
### Pro
1. **It's free**
2. Relatively easy
3. Extensibility ([CRAN](https://cran.r-project.org/), packages)
4. User base (e.g., [stackoverflow](https://stackoverflow.com/))
5. [Tidyverse](https://www.tidyverse.org/) (`dplyr`, `ggplot`, etc.)
6. [RStudio](https://www.rstudio.com/)
7. Producitivity options: [Latex](https://www.latex-project.org/), [Markdown](https://daringfireball.net/projects/markdown/), [GitHub](https://github.com/)
]
.pull-right5[
### Con
1. Slow and wordy
2. Limited (no iterators, pointers, etc.)
$\rightarrow$ [Rcpp](http://www.rcpp.org/), [rPython](http://rpython.r-forge.r-project.org/)
]
---
# RStudio: R's favorite environment
Next to many useful packages, R users greatly benefit from R's integrated development environment [RStudio](https://www.rstudio.com/). Rstudio is a graphical user interface that allows you to (a) edit code, (b) run code, (c) access files and progress, and (d) create plots. In addition RStudio helps you with version control via [Github](https://github.com/), to write reports using [markdown](http://rmarkdown.rstudio.com/authoring_basics.html) and [knitr](https://yihui.name/knitr/), integrating C++ into R, writing clean code, and to debug code.
wzxhzdk:4
---
# The workflow of R
wzxhzdk:5
---
# Project management
RStudio facilitate project management via the use of *projects*. Projects support:
.pull-left5[
1. **File management** by automatically setting the working directory (see `setwd()`)
2. **Project transitioning** by saving re-opening scripts, history, and workspace.
3. **Customization** by enabling project specific settings.
4. **Version control** by linking projects to repositories (e.g., using [GitHub](https://github.com/))
]
.pull-right5[
wzxhzdk:6
]
---
# The almighty **tidyverse**
Among its many packages, R contains a collection of high-performance, easy-to-use packages (libraries) designed specifically for handling data know as the [tidyverse](https://www.tidyverse.org/). The tidyverse includes:
1. `ggplot2` -- creating graphics.
2. `dplyr` -- data manipulation.
3. `tidyr` -- tidying data.
4. `readr` -- read wild data.
5. `purrr` -- functional programming.
6. `tibble` -- modern data frame.
wzxhzdk:7
---
# Essentials of the R language
.pull-left7[
>"To understand computations in R, two slogans are helpful:
>###(1) Everything that exists is an object and
>###(2) everything that happens is a function call."
]
.pull-right7[
John Chambers
Author of S and developer of R
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.