- Let us assign a values to two variables and do the Sum of two Variables.
Here assign A = 10 and B = 5 and run the two Lines of code
Lets us take another variable and name it as C and assign the summation of variable A and Variable B in Variable C
Here we can see value of C is 15
Note: If you want the C value to print in console pane, then type c in source pane
2. Let us assign the values to two variables and do the division
Here Var1 = 2.5, var2 = 4 and division result is stored in result Variable
3. Will find out the square root of Var2
Square root of var2 Variable stored in Res Variable.
We Can perform any arithmetic operations in R Language like Addition, Subtraction, Product, Division, square root, Calculator Operations and even perform Complex Calculations.
Now let us Move to character operations Just to Illustrate that we can do our best in Character Operations as well.
4.Character Operations :
Here Greeting and Name are variables and to concatenate both the variables we use function called Paste and store the concatenated Value in Message Variable. Select the Lines from 15 to 22 and click on Run Button or press Control + enter to execute.
After Executing the Output is shown in Variable message = “Hello sri”
I would Like to Invite you to Practice these Variables with Different arithmetic operations, For Instance try with Three Variables or Five variables to get Confidence in R programming.
Happy Coding…..