I’ve been afar for a while but I’ve returned with new ideas for this blog. This will be the my first entry for 2017 and it will be about R.
R is a language used for statistical analysis where you can implement Machine Learning techniques in order to process data.
First, we need to download R using this link. The instructions are pretty simple and once you have downloaded the executable file, you will be able to install R.
You can start working with the IDE that was included in the downloaded files. However I prefer to work using RStudio.
RStudio is an external IDE that can be found in two forms: the open-source version or the commercial one. You can download the open-source Desktop version from here.
Hello World with R
Now that we have downloaded everything we need, we can start working with R.
I prefer to use the RStudio IDE as it is similar to the MatLab IDE which I’m familiar with from several years by now. RStudio presents 4 windows which are the following:
In the Script window, we will write the following:
The first command will allocate the “Hello World” string to variable x. In order to execute this command, you need to move the cursor to that specific line and press “Ctrl + Enter”
Afterwards, the second command will print the “Hello World” string to the Console. Remember to execute the command with “Ctrl + Enter”.
Data analysis with R
Now, we will do a little Data Analysis with R. We will create a Data Frame that contains several animals, how many of those animals (frequency) and if they are pets.
Once we have created that Data Frame, we can print it in the Console. Also, we are able to extract which animals are considered pets, which animals are have a frequency higher than 10 and the data regarding only “Cats” and “Cows” using an IN clause.
In the uncoming posts, I will present more powerful projects using R!
- R is a powerful tool for data analysis. You can use the RStudio IDE, which is an open source IDE that allows to work with R easier.
- You can extract information from data structures in a easy way.