R Programming Introduction

Hello today we will start with basic introduction to R Programming for data analysis.

Lesson 1:Introduction to R


  • Using the Graphical User Interface R.
  • Getting data into R.
  • Arithmetic into R.
  • Data Types used in R.
  • R Operations.
  • Functions
  • Statistics for R.

How to Obtain R

R is available for Linux, MacOS, and Windows. RStudio  can be downloaded  https://www.rstudio.com/
What is Workspace

The workspace is the current  working environment for doing data analysis for R and it includes any user-defined objects (vectors, matrices, data frames, lists, functions). At the end of an R session, the user can save an image of the current workspace that is automatically reloaded the next time R is started.

What is Graphic User Interfaces

RStudio is the most popular R code editor and better interfaces with R for Windows,MacOS and Linux platform.
These  are most important things to remember about R.

  1. Everything is a object in R.
  2.  Everything is a vector in R.
  3. All commands are functions:    quit(),q().
  4. Some of the commands produce different arguments.
Now to do data analysis using R we have to first  install RStudio- https://www.rstudio.com/
 according to system specification windows/Ubuntu/Mac.

RStudio Graphical User Interface


Save the file using the extension my.R

Now the question is How to get data into and out of R

  • Type the data in Rstudio.
  • Read data by Database 
  • Read data from file

How to get data into and out of R


  • Save the data in your workspace
  • Save the data in file system.
  • Type in the text file.
Typing data into R


How to get data into R.

In the R prompt we type the code given below to print value.Here  symbol <- is used to assignment operator.

x <- 1
> print(x)
[1] 1
> x
[1] 1
> var <- "hi"

x <-     ## Incomplete expression
 Here the  #  character denotes the comment.R is  not used for multi line comments.


Arithmetic Operators in R

R is also used as a basic calculator and it supports many arithmetic operators.

# An addition
2 + 5

# A subtraction
7 - 5

# A multiplication
8 * 5

 # A division
(9 + 5) / 2

Output -

> # An addition

> 5 + 5
[1] 10
> 10
[1] 10

> # A subtraction

> 5 - 5
[1] 0
> 0
[1] 0

> # A multiplication

> 3 * 5
[1] 15
> 15
[1] 15

>  # A division

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

[1] 5

Comments

  1. Good initiative ma'am, although I would request you to further explain the above mentioned points concisely and don't just leave the points as it is. Further clarification will clear the concepts of reader.

    ReplyDelete
  2. Thanks for taking time to share this R programming introduction. It is really great.
    R Programming Training in Chennai | Data Analytics Training

    ReplyDelete

Post a Comment