-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path04-otherwin.Rmd
320 lines (201 loc) · 11.9 KB
/
04-otherwin.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# Windows 10 Home/pre-10 {#otherWin .unnumbered}
This guide covers the installation of R and RStudio on machines running Windows 10 Home Edition or versions of Windows prior to Windows 10 (e.g. Windows 7). With this approach, you will install R and RStudio "natively", that is running directly on your operating system. If you are not sure what version of Windows you are running, check out this [guide](#windows-version).
<div class="alert alert-danger" style="font-size:120%">
<b>IMPORTANT</b>: <br>
This module has been written using the most up-to-date versions of R, RStudio and relevant packages. To avoid software compatibility issues it is important you have these same versions installed on your home computer.
**Therefore, if you have R or RStudio already installed on your computer, please first uninstall them unsing the instructions [here](#uninstall_otherwin).**
</div>
## Download and Install R {.unlisted .unnumbered}
### Download R {.unlisted .unnumbered}
R is the coding software that will execute the code you write in RStudio.
**NOTE: You need to install R before you install RStudio**
```{r fig1, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Picture_1.PNG")
```
- Open the [R download page](https://cran.rstudio.com/) in your browser and click on **Download R for Windows**.
```{r fig2, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Picture_2.PNG")
```
- Click on **base** (highlighted in red here) as you are installing R for the first time.
```{r fig3, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Picture_3.PNG")
```
- Click on **Download R 4.0.3 for Windows** (highlighted in red here) to start the download.
### Install R {.unlisted .unnumbered}
```{r fig4, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Picture_4.PNG")
```
- Navigate to your **Downloads** folder and double click on the **_R-4.0.3-win_** file.
**NOTE: Once you double click on the file, a window might pop up that asks you if you want to allow this app to make changes to your device click _YES_ to continue the installation**
```{r fig5, fig.align = 'center', echo = FALSE, out.width = "350px"}
knitr::include_graphics("figs/chp4/R_1.PNG")
```
- A new window will pop up asking you to select a language for the installation. Select **English** and click **_OK_**.
```{r fig6, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/R_2.PNG")
```
- The next window shows the Terms and Conditions. Click **_Next_** to continue with the installation.
```{r fig7, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/R_3.PNG")
```
- The next window will ask you to specify where you would like to install R. Leave the default settings and click **_Next_**.
```{r fig8, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/R_4.PNG")
```
- The next window will ask you what components of R you want to install. Leave the default settings (all boxes ticked) and click **_Next_**.
```{r fig9, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/R_5.PNG")
```
- The next window will ask you if you want to customise the startup options.
- Select **No** and click **_Next_**.
```{r fig10, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/R_6.PNG")
```
- The next window will ask you to select/name a start menu folder.
- Leave the default settings (R) and click **_Next_**.
```{r fig11, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/R_7.PNG")
```
- The next window will ask you to select additional task that will be performed while installing R.
- Leave the default (Additional shortcuts unticked,Registry entries ticked) and click **_Next_** .
```{r fig12, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/R_8.PNG")
```
- R will now install.
```{r fig13, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/R_9.PNG")
```
- Once the installation is complete, click **_Finish_**.
## Download and Install RStudio {.unlisted .unnumbered}
### Download RStudio {.unlisted .unnumbered}
R-Studio is the R user interface in which you can code.
```{r fig14, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Studio_1.PNG")
```
- Go to the [R-studio download page](https://rstudio.com/products/rstudio/download/).
```{r fig15, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Studio_2.PNG")
```
- On the download page, scroll down and click on the **_Download_** button under **RStudio Desktop**.
```{r fig16, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Studio_3.PNG")
```
- Click on **Download RStudio for Windows** to download the installation file
### Install RStudio {.unlisted .unnumbered}
```{r fig17, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Studio_4.PNG")
```
- Navigate to your **Downloads** folder and double click on the **RStudio-1.4.1103** file.
**NOTE: Once you double click on the file, a window might pop up that asks you if you want to allow this app to make changes to your device click _YES_ to continue the installation**
```{r fig18, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/Studio_5.PNG")
```
- In the installation window that opens, click **_Next_**.
```{r fig19, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/Studio_6.PNG")
```
- In the next window, you can specify where you want to install RStudio.
- Leave the default settings and click **_Next_**.
```{r fig20, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/Studio_7.PNG")
```
- The next window will ask you to choose a Start Menu Folder.
- Leave the default settings (RStudio) and click **_Next_**.
```{r fig21, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/Studio_8.PNG")
```
- RStudio is now installing.
```{r fig22, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/Studio_9.PNG")
```
- Once the intallation is completed, click on **_Finish_**.
## Open RStudio {.unlisted .unnumbered}
```{r Inst23, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Studio_10.PNG")
```
- To open RStudio, click on the Windows logo in the left bottom corner of your screen and either type **_RStudio_** or look for the **RStudio folder** in the menu.
- Double click on Rstudio to open it.
<center>
## Install Packages {.unlisted .unnumbered}
In order to complete the course, you will need to have installed all the required packages. The simplest way to do this is to run the below code in RStudio.
```{r, eval=FALSE}
list.of.packages.cran <- c(
"arm", "car", "corrplot", "FRK", "gghighlight",
"ggplot2", "ggmap", "GISTools", "gridExtra", "gstat",
"jtools", "kableExtra", "knitr", "lme4", "lmtest",
"lubridate", "MASS", "merTools", "plyr", "RColorBrewer",
"rgdal", "sf", "sjPlot", "sp", "spgwr",
"spatialreg", "spacetime", "stargazer", "tidyverse", "tmap",
"viridis", "tufte"
)
new.packages.cran <- list.of.packages.cran[!(list.of.packages.cran %in% installed.packages()[,"Package"])]
if(length(new.packages.cran)) install.packages(new.packages.cran)
for(i in 1:length(list.of.packages.cran)) {
library(list.of.packages.cran[i], character.only = T)
}
```
- Copy the code above by clicking the button to the top right of the code chunk which says **Copy to clipboard** when you hover over it.
```{r Packages_1, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Packages_1.png")
```
- Open _RStudio_ and click the image of a _'white and green plus sign on top of a white square'_ that says **New File** when you hover over it. Then, from the drop-down menu that appears, click on the option **R Script**.
```{r Packages_2, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Packages_2.png")
```
- A new window with a blank background and the heading **_Untitled1_** (indicated by red arrow above) should appear.
- Paste the copied code into this window by right-clicking and selecting **Paste**.
```{r Packages_3, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Packages_3.png")
```
- Click on the **Code** menu at the top of the screen. Select **Run Region** from the drop-down menu, then click **Run All** from the second drop-down menu.
- This should install all the packages you need to complete the ‘Spatial Modelling for Data Scientists’ module.
<div class="alert alert-success" style="font-size:120%">
<b>NOTE</b>: <br>
The script will install several dozen packages on your computer. This could take around 20-30 minutes to complete, depending on you computer and bandwidth.
</div>
```{r Packages_4, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Packages_4.png")
```
- Once the code has finished running, a blue arrow with a gray vertical line next to it (indicated by red arrow above) will appear at the bottom of the _Console_ window at the bottom left of the screen. This means R has finished the task it was given and is ready for it's next command.
```{r Packages_5, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Packages_5.png")
```
- You can now close the _R Script_ file you created by clicking on the `x` next to the header **_Untitled1_** (indicated by red arrow above). You do not need to save the file.
<br>
<div class="alert alert-success" style="font-size:120%">
Congratulations!!! You have now successfully installed R, RStudio and all packages required to complete the course!
You can now start coding.
</div>
![](https://media.giphy.com/media/PiQejEf31116URju4V/giphy.gif)
<br>
## Uninstall R and RStudio {#uninstall_otherwin .unnumbered}
This section shows how to uninstall programs on Windows 10 Home Edition. You only need to read this section if you have an older version of R or RStudio already installed on your computer.
```{r Uninstall_1, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Uninstall_1.png")
```
- Right click on the Windows logo in the left bottom corner of your screen and click on **Settings**.
```{r Uninstall_2, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Uninstall_2.png")
```
- At the _Settings_ menu, click on **Apps**.
```{r Uninstall_3, fig.align = 'center', echo = FALSE}
knitr::include_graphics("figs/chp4/Uninstall_3.png")
```
- This should take you to a page called _Apps & features_, where you can select programs to uninstall. Scroll down until you see any program relating to R or RStudio (in this case 'R 3.6.1', RStudio and 'Rtools version 3.5').
- Click on the program you wish to uninstall and select **Uninstall**.
**NOTE: Once you click Uninstall, a window might pop up that asks you if you want to allow this app to make changes to your device click _YES_ to continue.**
```{r Uninstall_4, fig.align = 'center', echo = FALSE, out.width = "400px"}
knitr::include_graphics("figs/chp4/Uninstall_4.png")
```
- You will then be asked whether you are sure you want to remove the program. Click **Yes**.
```{r Uninstall_5, fig.align = 'center', echo = FALSE, out.width = "600px"}
knitr::include_graphics("figs/chp4/Uninstall_5.png")
```
- The program is now uninstalling.
```{r Uninstall_6, fig.align = 'center', echo = FALSE, out.width = "400px"}
knitr::include_graphics("figs/chp4/Uninstall_6.png")
```
- Once this is complete, you will get a message confirming that the installation was successful. Click **OK**.
<br>
**CONGRATULATIONS YOU HAVE NOW SUCCESFULLY UNINSTALLED THE PROGRAM!**
**Make sure to repeat this process until all programs relating to R (i.e. R, RStudio and Rtools) have been uninstalled from your machine.**