Skip navigation
2020

R is a very Powerful Programming Software which is used to Model the Data, Visualize the Data, Fitting the  data into Statistical Models.

 

Here we need not run the Specifically, Once we enter then we get the Result immideately, if we wat to see the same thing re-run the code.

 

Once we open the R Console, we get the sign >, It says us, we can enter the Valid data.

 

 

Assign the Values: We can assign the values in several ways in R Programming.

1) Using the Assign function.

> assign("Assign_1", "Tableau")

> print(Assign_1)

[1] "Tableau"

 

2) Using "=" to assign the value.

> Assign_2 = "Tableau Software"

> print(Assign_2)

[1]  "Tableau Software"

 

3) Using <- to assign the value.

> Assign_3 <-  "Tableau Softweare, USA"

> print(Assign_3)

[1] "Tableau Softweare, USA"

===================================================================================

Comments: We can express the comments using # (ash) sign.

EX: 1

#This is First Comment

print("This is my first R Language Program!!!!!!!!!!!!!!!!!")

[1] "This is my first R Language Program!!!!!!!!!!!!!!!!!"

 

EX: 2

#This is Second Comment

print("This is my  Second R Language Program!!!!!!!!!!!!!!!!!")

[1] "This is my Second R Language Program!!!!!!!!!!!!!!!!!"

 

EX: 3

print("This is my first R Language Program!!!!!!!!!!!!!!!!!") # This is Input, it will be executed then returns which is in Double Quotations

"This is my first R Language Program!!!!!!!!!!!!!!!!!"  # This is Output

 

EX 4:

First_R<- "First Program !!"

> Print(First_R) # We can treat calling the Variable

[1]  "First Program !!"

 

===================================================================================

Variables: We can use the Variables to store the data or to allocate the memory in the Disc.

1) If we we want to store 1 value in the Variable, we assign directly as below.

> My_First_Variable = "Tableau"

> print(My_First_Variable)

 

2) We can store more than 1 Value/ Element in a varaible using the "c", here c standas for combining.

 

EX:

> My_Second_Variable =c(  "Tableau", "Software")

> print(My_Second_Variable)

[1]  "Tableau"  "Software"

 

> My_Third_Variable =c(  "Tableau", "Software", "USA")

> My_Third_Variable

[1] "Tableau"  "Software" "USA"

 

> print(My_Third_Variable)

[1] "Tableau"  "Software" "USA"

 

#  Here, If we execute the print(My_Third_Variable)  or My_Third_Variable , we get the same Output.

===================================================================================

We can perform Mathematical operations directly, I am trying to execute the the following examples.

 

EX: 1)

> 2+3    # Here I did not assign any variable  call for Arithematic Calculation.

[1] 5

 

EX:2 )

> A1= 4              # Assign the value 4 to variable A1

> A2=10           # Assign the value 10 to variable A1

>A1+A2           # Performing summation of A1 and A2, Once we execute this program, We get the O/P directly

[1] 14

 

EX: 3) In the following example, I am executing multiple programms at a time, those are separated by ;  which sign indicates program coding is over it means terminate that code.

> A1= 4; A2=10; A1+A2;

[1] 14   # This is the O/P of the above code