R programming language

 There are millions of programming languages out there. But each one's have different functionality and uses. So, today we gonna talk about R language. 

R language was developed by Ross Ihaka and Robert Gentleman in 1993. This language is basically used for statistical analysis and graphical representation of data. 

So, as you know all language has different syntax and token's let's see about R language.

1) Comment: Comment are basically a sentence in the program which is not executed it is just use to make program more informative for the person who is reading your program. To use comment we use a symbol hash (#). Ex: #program to print Hello World.

2) Variables: variables are basically a place to store a data. Ex: a=10. Here a is a variable of type numeric. There are certain rules for creating variables which are 

1) variable name must start With a letter only. 

2) But variable can contain underscore (_) and Dot sign, no special characters are used

Ex: Of invalid variable: _a, 1a, &a

        Valid variable: a1, a_2, count

3) Data types: Data type defines the variable type to store the data there are basically 5 types of data types available in R 

1) Numeric Data type:

 In R, Numeric data type contains decimal values. Also, for storing numerical data ’numeric’ is default in R not ’integer’. 

For Example-
a = 12.5
# Here ’a’ is numeric variable 

2) Integer Data Type:

In R, to create an integer variable we need to use as.integer().
For example-
c = as.integer(32)
class(c)
Output-
"integer" 

3) Complex Data Type:

In R, complex data type includes an imaginary value(i).
For example-
a = 45+2i
class(a)
Output-
"complex" 

4) Logical Data Type:

In R, Logical data type return either true or false.
For example-
A = 45
B = 43
C = a < b
class (c)
Output:
"Logical" 

5) Character Data Type:

In R, Character data type holds string values.
For example-
A = 'Rinky Maurya'
class(a)
Output-
"character" 

Here, in every example class function is used to check the Data type of variable.

1) program

# program to print Hello World

 A="Hello World"

print (a)

Here print function is used to print anything to output screen or on terminal.

2) program for mathematical function

A= 20

B= 30

print (A+B)

Print (A-B)

And many more

So, this was some basics of R language you can do many more in this language. Further we will talk in next post. Till that byeeeeee take care met you in next post........


Comments