forked from rafalab/dsbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstalling-r-and-rstudio.Rmd
170 lines (116 loc) · 5.73 KB
/
installing-r-and-rstudio.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Installing R and RStudio {#installing-r-rstudio}
```{r, include=FALSE}
if(knitr::is_html_output()){
knitr::opts_chunk$set(out.width = "500px",
out.extra='style="display: block; margin-left: auto; margin-right: auto; background-color: #000; padding:3px;"')
} else{
knitr::opts_chunk$set(out.width = "4in")
}
```
The instructions below include screen shots from the installation process in which we used the Chrome browser which, although not necessary, you can freely download and install from here: [https://www.google.com/chrome/](https://www.google.com/chrome/).
## Installing R
```{r, echo=FALSE}
img_path <- "productivity/img"
screenshots <- list.files(file.path(img_path, "windows-screenshots"))
screenshots <- file.path(img_path, "windows-screenshots", screenshots)
mac_screenshots <- list.files(file.path(img_path, "mac-screenshots"))
mac_screenshots <- file.path(img_path,"mac-screenshots", mac_screenshots)
```
RStudio is an interactive desktop environment, but it is not R, nor does it include R when you download and install it. Therefore, to use RStudio, we first need to install R.
1. You can download R from the Comprehensive R Archive Network (CRAN)^[https://cran.r-project.org/]. Search for CRAN on your browser:
```{r, echo=FALSE}
knitr::include_graphics(screenshots[1])
```
2. Once on the CRAN page, select the version for your operating system: Linux, Mac OS X, or Windows.
```{r, echo=FALSE}
knitr::include_graphics(screenshots[2])
```
Here we show screenshots for Windows, but the process is similar for the other platforms. When they differ, we will also show screenshots for Mac OS X.
3. Once at the CRAN download page, you will have several choices. You want to install the _base_ subdirectory. This installs the basic packages you need to get started. We will later learn how to install other needed packages from within R, rather than from this webpage.
```{r, echo=FALSE}
knitr::include_graphics(screenshots[3])
```
4. Click on the link for the latest version to start the download.
```{r, echo=FALSE}
knitr::include_graphics(screenshots[4])
```
5. If you are using Chrome, at the bottom of your browser you should see a tab that shows you the progress of the download. Once the installer file downloads, you can click on that tab to start the installation process. Other browsers may be different, so you will have to find where they store downloaded files and click on them to get the process started.
```{r, echo=FALSE}
knitr::include_graphics(screenshots[5])
```
If using Safari on a Mac, you can access the download through the download button.
```{r, echo=FALSE}
knitr::include_graphics(mac_screenshots[14])
```
6. You can now click through different choices to finish the installation. We recommend you select all the default choices.
```{r, echo=FALSE}
knitr::include_graphics(screenshots[6])
```
Select the default even when you get an ominous warning.
```{r, echo=FALSE}
knitr::include_graphics(screenshots[7])
```
When selecting the language, consider that it will be easier to follow this book if you select English.
```{r, echo=FALSE}
knitr::include_graphics(screenshots[8])
```
Continue to select all the defaults:
```{r, echo=FALSE, out.width = "45%", out.extra=""}
knitr::include_graphics(screenshots[9:12])
```
```{r, echo=FALSE, out.width = "45%", out.extra=""}
knitr::include_graphics(screenshots[13:15])
```
On the Mac it looks different, but you are also accepting the defaults:
```{r, echo=FALSE, out.width = "45%", out.extra=""}
knitr::include_graphics(mac_screenshots[15:18])
```
```{r, echo=FALSE, out.width = "45%", out.extra=""}
knitr::include_graphics(mac_screenshots[19:23])
```
Congratulations! You have installed R.
## Installing RStudio
1. You can start by searching for RStudio on your browser:
```{r, echo=FALSE}
knitr::include_graphics(screenshots[18])
```
2. You should find the RStudio website as shown above. Once there, click on _Download RStudio_.
```{r, echo=FALSE}
knitr::include_graphics(screenshots[19])
```
3. This will give you several options. For what we do in this book, it is more than enough to use the free Desktop version:
```{r, echo=FALSE}
knitr::include_graphics(screenshots[20])
```
4. Once you select this option, it will take you to a page in which the operating system options are provided. Click the link showing your operating system.
```{r, echo=FALSE}
knitr::include_graphics(screenshots[21])
```
5. Once the installation file is downloaded, click on the downloaded file to start the installation process:
```{r, echo=FALSE}
knitr::include_graphics(screenshots[22])
```
6. We recommend clicking yes on all the defaults.
```{r, echo=FALSE, out.width = "45%", out.extra=""}
knitr::include_graphics(screenshots[23:25])
```
```{r, echo=FALSE, out.width = "45%", out.extra=""}
knitr::include_graphics(screenshots[26:28])
```
On the Mac, there are fewer clicks. You basically drag and drop the RStudio icon into the Applications folder icon here:
```{r, echo=FALSE}
knitr::include_graphics(mac_screenshots[30])
```
Congratulations! You have installed RStudio. You can now get started as you do on any other program in your computer.
On Windows, you can open RStudio from the _Start_ menu. If RStudio does not appear, you can search for it:
```{r, echo=FALSE}
knitr::include_graphics(screenshots[29])
```
On the Mac, it will be in the Applications folder:
```{r, echo=FALSE, out.width = "45%", out.extra=""}
knitr::include_graphics(mac_screenshots[31:32])
```
**Pro tip for the Mac**: To avoid using the mouse to open RStudio, hit command+spacebar to open _Spotlight Search_ and type RStudio into that search bar, then hit enter.
```{r, include=FALSE}
knitr::opts_chunk$set(out.width = NULL, out.extra = NULL)
```