Basic calculations with R | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Basic calculations with R

The basic of R is that it works like a simple calculator. If you for example run this line of code: > 1 + 1 The console will give as output: 2 You can do the same for multiplying or dividing for example. Here is a short overview of the operators you can use for example: + adding, - subtracting, * multiplying / division

9th Apr 2018, 3:07 PM
Mathijs
Mathijs - avatar
1 Answer
+ 2
Privalage to a part of your calculation can be given with adding ( ... ) for example to subtract 4 by 1 and then multiply by 3 run the following code: > (4 - 1) * 3 The console will give as output: 9 Note: Without brackets the console will first multiply 1 by 3 and then substract from 4.
9th Apr 2018, 3:07 PM
Mathijs
Mathijs - avatar