Hello my friends, welcome to this new tutorial.
In this one I'm going to show you how to install R and RStudio on your machine.
All right so let's do this. We have to start with R.
So here in the search bar we're going to type create n press enter.
And we're going to click the first link of the comprehensive R archive network.
Because that's exactly where we can download and install R
for the three systems Linux, Mac OS and windows.
So let me show you quickly how to do it for the three starting with Linux.
Download R for Linux.
So here make sure to choose your Linux system.
For example, I'm going to show this to you for ubuntu.
And then you simply need to follow the instructions here.
So you open your Linux terminal.
Then you're going to enter these four command lines, after which
you will run this command line to install R and its dependencies.
And that's it.
That's all you need to do on Linux.
You just install R by running these commands.
All right.
So now let me show you how to do this for windows.
For windows I recommend to click base here because this is the easy option
if you want to install R for the first time.
So let's do this. Let's choose this one.
And then you simply click this link to install the latest version.
You might get a different one when you take this tutorial.
At the time I'm speaking it is 4.2.2.
All right I'm on a mac, so I'm not going to download here.
And well,
speaking of Mac, I'm going to show you now how to download or from Mac OS.
So we click this link here.
Then we're going to take the latest release again.
And then make sure here to select the right package file
according to your Mac OS system.
So for Mac OS 11 Big Sur and higher Apple Silicon Arm64 this is what you want.
And then for Mac OS 10.13 High Sierra and higher Intel 64 bit.
This is what you want.
So as far as I'm concerned I'm in this case.
And so I'm going to click this link to download the version 4.2.24.
And so I'm going to click save.
And this will download.
there we go. It was very fast.
So now I'm going to go to my downloads folder.
I'm going to double click it.
And then we're just going to click continue here
to install or on our machine.
Agree and install. There we go.
And now it is installing.
and perfect installation was successful.
Great. So now you have on your machine.
That's great. But we want an easy interface.
You know a very user friendly interface when coding with R.
And that's why it's also very good to install RStudio.
So we're going to go back to our favorite browser.
And this time we're going to enter R studio.
There we go RStudio.
You click the first link and you're going to download our studio.
So let's click this link first.
There we go to RStudio IDE.
That's exactly what we want.
And we're going to take the RStudio desktop.
So let's click download RStudio again.
Then let's scroll down and let's find the right one for our system.
So download and install R.
We've already done it on Cran.
And if you scroll down you will find RStudio for your system.
All right windows Mac OS, ubuntu ubuntu 22 and some more below
okay so here I'm on a mac.
So again I'm going to take this one then save done.
So now I'm going to go back to my downloads folder.
I'm going to double click this one.
Now I'm going to put it in my applications.
And in a second I will have RStudio installed on my machine.
So let's close this.
And now let's open RStudio.
And let me introduce you to it.
So I'm going to find it right here.
Open. And welcome to our studio.
All right.
So first we can see that RStudio is divided into three panels.
This panel here which is the console where you can execute
some code like for example two plus two and press enter.
Then this is the environment panel where the variables of
your code will be created when you execute it.
And then the third panel here
which is your files, you know from your computer
where you can access your codes and your data set.
So for example, let's go to my desktop where I have the whole machine learning
is that code and data sets folder.
Then let's enter it.
Let's take for example part two regression and the simplest model
simple linear regression.
And then the R folder.
So here you can find the code of disciplinary aggression model
the R code right.
And then the data set salary data dot csv.
So to open the model you simply click on it.
It will appear here in the fourth panel where you can edit the code in this.
Awful. Right.
So now just for fun, just to give us an exciting introductory note on R,
let's execute this code.
But before we execute it, the first thing we always have to do
is to set this folder as working directory folder
so that when we import the data set here,
while the console knows where to access it, which is in this folder.
And so to set this folder as working
directory we simply click more here and then set as working directory.
There we go.
And now we can simply select the whole code here
and then press Command or Control plus enter to execute it.
And there we go.
As you can see now the code is execute in the console.
And soon enough we can see our variables in the environment.
All the variables that are in this code and the two plots
of the training set and the test set.
Of course, all these steps will be explained in details
when we implement a simple linear regression model.
This was just a teaser of what we're going to do in R.
And speaking of which,
I look forward to seeing you in the next practical activities on Python
and R to implement our models, and until then, enjoy machine learning.