1 00:00:00,166 --> 00:00:02,366 Hello my friends, welcome to this new tutorial. 2 00:00:02,366 --> 00:00:06,666 In this one I'm going to show you how to install R and RStudio on your machine. 3 00:00:06,900 --> 00:00:09,133 All right so let's do this. We have to start with R. 4 00:00:09,133 --> 00:00:13,633 So here in the search bar we're going to type create n press enter. 5 00:00:13,900 --> 00:00:18,266 And we're going to click the first link of the comprehensive R archive network. 6 00:00:18,266 --> 00:00:21,666 Because that's exactly where we can download and install R 7 00:00:21,666 --> 00:00:24,833 for the three systems Linux, Mac OS and windows. 8 00:00:24,833 --> 00:00:28,200 So let me show you quickly how to do it for the three starting with Linux. 9 00:00:28,366 --> 00:00:29,533 Download R for Linux. 10 00:00:29,533 --> 00:00:31,833 So here make sure to choose your Linux system. 11 00:00:31,833 --> 00:00:34,300 For example, I'm going to show this to you for ubuntu. 12 00:00:34,300 --> 00:00:36,900 And then you simply need to follow the instructions here. 13 00:00:36,900 --> 00:00:39,000 So you open your Linux terminal. 14 00:00:39,000 --> 00:00:42,366 Then you're going to enter these four command lines, after which 15 00:00:42,366 --> 00:00:46,700 you will run this command line to install R and its dependencies. 16 00:00:46,700 --> 00:00:47,533 And that's it. 17 00:00:47,533 --> 00:00:49,000 That's all you need to do on Linux. 18 00:00:49,000 --> 00:00:51,400 You just install R by running these commands. 19 00:00:51,400 --> 00:00:51,900 All right. 20 00:00:51,900 --> 00:00:55,366 So now let me show you how to do this for windows. 21 00:00:55,633 --> 00:00:59,300 For windows I recommend to click base here because this is the easy option 22 00:00:59,300 --> 00:01:01,400 if you want to install R for the first time. 23 00:01:01,400 --> 00:01:03,366 So let's do this. Let's choose this one. 24 00:01:03,366 --> 00:01:07,000 And then you simply click this link to install the latest version. 25 00:01:07,000 --> 00:01:09,466 You might get a different one when you take this tutorial. 26 00:01:09,466 --> 00:01:12,400 At the time I'm speaking it is 4.2.2. 27 00:01:12,400 --> 00:01:15,133 All right I'm on a mac, so I'm not going to download here. 28 00:01:15,133 --> 00:01:15,733 And well, 29 00:01:15,733 --> 00:01:19,466 speaking of Mac, I'm going to show you now how to download or from Mac OS. 30 00:01:19,466 --> 00:01:21,000 So we click this link here. 31 00:01:21,000 --> 00:01:23,133 Then we're going to take the latest release again. 32 00:01:23,133 --> 00:01:26,100 And then make sure here to select the right package file 33 00:01:26,100 --> 00:01:28,000 according to your Mac OS system. 34 00:01:28,000 --> 00:01:33,366 So for Mac OS 11 Big Sur and higher Apple Silicon Arm64 this is what you want. 35 00:01:33,600 --> 00:01:37,666 And then for Mac OS 10.13 High Sierra and higher Intel 64 bit. 36 00:01:37,666 --> 00:01:38,433 This is what you want. 37 00:01:38,433 --> 00:01:41,333 So as far as I'm concerned I'm in this case. 38 00:01:41,333 --> 00:01:46,266 And so I'm going to click this link to download the version 4.2.24. 39 00:01:46,266 --> 00:01:47,833 And so I'm going to click save. 40 00:01:47,833 --> 00:01:49,633 And this will download. 41 00:01:49,633 --> 00:01:51,366 there we go. It was very fast. 42 00:01:51,366 --> 00:01:54,333 So now I'm going to go to my downloads folder. 43 00:01:54,333 --> 00:01:55,900 I'm going to double click it. 44 00:01:55,900 --> 00:01:58,933 And then we're just going to click continue here 45 00:01:59,066 --> 00:02:01,700 to install or on our machine. 46 00:02:01,700 --> 00:02:04,700 Agree and install. There we go. 47 00:02:04,833 --> 00:02:06,100 And now it is installing. 48 00:02:06,100 --> 00:02:09,400 and perfect installation was successful. 49 00:02:09,700 --> 00:02:12,266 Great. So now you have on your machine. 50 00:02:12,266 --> 00:02:14,700 That's great. But we want an easy interface. 51 00:02:14,700 --> 00:02:17,700 You know a very user friendly interface when coding with R. 52 00:02:17,733 --> 00:02:20,733 And that's why it's also very good to install RStudio. 53 00:02:20,733 --> 00:02:23,133 So we're going to go back to our favorite browser. 54 00:02:23,133 --> 00:02:26,133 And this time we're going to enter R studio. 55 00:02:26,200 --> 00:02:28,433 There we go RStudio. 56 00:02:28,433 --> 00:02:31,766 You click the first link and you're going to download our studio. 57 00:02:31,766 --> 00:02:33,300 So let's click this link first. 58 00:02:33,300 --> 00:02:35,100 There we go to RStudio IDE. 59 00:02:35,100 --> 00:02:36,500 That's exactly what we want. 60 00:02:36,500 --> 00:02:38,700 And we're going to take the RStudio desktop. 61 00:02:38,700 --> 00:02:41,100 So let's click download RStudio again. 62 00:02:41,100 --> 00:02:44,833 Then let's scroll down and let's find the right one for our system. 63 00:02:44,833 --> 00:02:46,200 So download and install R. 64 00:02:46,200 --> 00:02:47,966 We've already done it on Cran. 65 00:02:47,966 --> 00:02:52,066 And if you scroll down you will find RStudio for your system. 66 00:02:52,066 --> 00:02:56,300 All right windows Mac OS, ubuntu ubuntu 22 and some more below 67 00:02:56,433 --> 00:02:58,633 okay so here I'm on a mac. 68 00:02:58,633 --> 00:03:03,300 So again I'm going to take this one then save done. 69 00:03:03,300 --> 00:03:05,400 So now I'm going to go back to my downloads folder. 70 00:03:05,400 --> 00:03:07,166 I'm going to double click this one. 71 00:03:07,166 --> 00:03:09,666 Now I'm going to put it in my applications. 72 00:03:09,666 --> 00:03:13,266 And in a second I will have RStudio installed on my machine. 73 00:03:13,266 --> 00:03:14,633 So let's close this. 74 00:03:14,633 --> 00:03:16,100 And now let's open RStudio. 75 00:03:16,100 --> 00:03:17,800 And let me introduce you to it. 76 00:03:17,800 --> 00:03:20,733 So I'm going to find it right here. 77 00:03:20,733 --> 00:03:23,733 Open. And welcome to our studio. 78 00:03:23,833 --> 00:03:24,100 All right. 79 00:03:24,100 --> 00:03:27,500 So first we can see that RStudio is divided into three panels. 80 00:03:27,500 --> 00:03:30,700 This panel here which is the console where you can execute 81 00:03:30,700 --> 00:03:33,700 some code like for example two plus two and press enter. 82 00:03:34,033 --> 00:03:37,100 Then this is the environment panel where the variables of 83 00:03:37,100 --> 00:03:40,100 your code will be created when you execute it. 84 00:03:40,166 --> 00:03:41,833 And then the third panel here 85 00:03:41,833 --> 00:03:43,900 which is your files, you know from your computer 86 00:03:43,900 --> 00:03:46,233 where you can access your codes and your data set. 87 00:03:46,233 --> 00:03:49,400 So for example, let's go to my desktop where I have the whole machine learning 88 00:03:49,433 --> 00:03:51,400 is that code and data sets folder. 89 00:03:51,400 --> 00:03:52,366 Then let's enter it. 90 00:03:52,366 --> 00:03:55,633 Let's take for example part two regression and the simplest model 91 00:03:55,666 --> 00:03:57,066 simple linear regression. 92 00:03:57,066 --> 00:03:58,833 And then the R folder. 93 00:03:58,833 --> 00:04:01,766 So here you can find the code of disciplinary aggression model 94 00:04:01,766 --> 00:04:02,766 the R code right. 95 00:04:02,766 --> 00:04:05,466 And then the data set salary data dot csv. 96 00:04:05,466 --> 00:04:08,466 So to open the model you simply click on it. 97 00:04:08,633 --> 00:04:12,900 It will appear here in the fourth panel where you can edit the code in this. 98 00:04:12,900 --> 00:04:14,266 Awful. Right. 99 00:04:14,266 --> 00:04:18,100 So now just for fun, just to give us an exciting introductory note on R, 100 00:04:18,200 --> 00:04:19,666 let's execute this code. 101 00:04:19,666 --> 00:04:22,866 But before we execute it, the first thing we always have to do 102 00:04:23,066 --> 00:04:26,700 is to set this folder as working directory folder 103 00:04:26,733 --> 00:04:30,066 so that when we import the data set here, 104 00:04:30,066 --> 00:04:33,666 while the console knows where to access it, which is in this folder. 105 00:04:33,966 --> 00:04:35,966 And so to set this folder as working 106 00:04:35,966 --> 00:04:39,900 directory we simply click more here and then set as working directory. 107 00:04:40,133 --> 00:04:41,033 There we go. 108 00:04:41,033 --> 00:04:43,933 And now we can simply select the whole code here 109 00:04:43,933 --> 00:04:48,300 and then press Command or Control plus enter to execute it. 110 00:04:48,300 --> 00:04:49,033 And there we go. 111 00:04:49,033 --> 00:04:52,033 As you can see now the code is execute in the console. 112 00:04:52,166 --> 00:04:56,100 And soon enough we can see our variables in the environment. 113 00:04:56,100 --> 00:04:59,700 All the variables that are in this code and the two plots 114 00:04:59,966 --> 00:05:02,933 of the training set and the test set. 115 00:05:02,933 --> 00:05:05,933 Of course, all these steps will be explained in details 116 00:05:06,100 --> 00:05:08,266 when we implement a simple linear regression model. 117 00:05:08,266 --> 00:05:11,466 This was just a teaser of what we're going to do in R. 118 00:05:11,633 --> 00:05:12,700 And speaking of which, 119 00:05:12,700 --> 00:05:16,566 I look forward to seeing you in the next practical activities on Python 120 00:05:16,566 --> 00:05:21,066 and R to implement our models, and until then, enjoy machine learning.