Machine Learning with R

Purpose of this tutorial is to get familiar with R programming and how it is used to do machine learning in modern era.

 

Getting to know R layout:

As per Wiki,

R is a programming language and free software environment for statistical computing and graphics. The R language is widely used among statisticians and data miners for developing statistical software and data analysis.

In simple language, R is used for getting information about data and making insights about data.

It can also be used to make some predictions out of data.

We will see how R is used for machine learning and how simple is this programming language.

Best part of R is that it is free to download.

Following you can find a link to DOWNLOAD R:

https://cran.r-project.org/

After downloading R, you will get on the following page with bunch of commands:

Press CTRL+L to clear the screen for now. Every time you think the screen is taking too much space like shown in the picture above, pressing CTRL+L will help clear the screen for us.

As you can see in the picture there are different functionalities or menus available:

File: Basic functionality of opening new file or saved file. We can change current directory too.

Packages: To perform tasks like text mining, data visualization and predictions, sometime packages help us do that and by going to this menu we can install packages.

We will explore more of these menus and functionality slowly and interactively.

 

Using R as a Calculator:

Before we begin, it is important to know that “>” symbol means you should start writing your code here.

 

 

 

 

 

 

 

As you can see in the above picture, R is doing calculations based on numbers we provide.

Write the number 5 after > sign and press enter key on keyboard

>5

Above will just show the number we entered with result:

[1] 5

[1] means the length of the number which in this case is 1 and 5 is the number we entered which R just throws back as there is no calculation done on this number.

Rest of the code and their result is shown:

> 2+5
[1] 7
> 3-1
[1] 2
> 10*10
[1] 100
> 25/5
[1] 5

R follows PEMDAS functionality for calculations which means Parenthesis Exponent Mulitply Divide Add Subtract 

So, this code will give us:

> (3+2)/5
[1] 1

For exponent calculation we use “^” symbol.

> 2^5
[1] 32

sqrt() is a function that returns the square root of whatever number entered in parenthesis.

> sqrt(100)
[1] 10

Please Note: R is case-sensitive language, meaning, sqrt is not same as SQRT or SqRT.

 

 

Rest of the tutorials are in the links below.

It is totally OK if you are baffled in the beginning just keep doing what we mention on our website and you will get a clear idea of R.

1. Directories, Packages and Saving Data

2. R – Data Structures

3. Subset data with R

4. Extracting information out of data

5. Simple Linear Regression

6. Multiple Linear Regression

 

Leave a Reply

avatar
  Subscribe  
Notify of