There is no programming language without this feature. R is different then other programming languages in regards of approach to this subject, because it treats most of values in table form out of box. This is what usually confuses new R developers, especially if they have learned some other programming language previously.
First, we are going to talk about 4 basic arithmetic operations:
Let's have two variables
a<-21
b<-10
In order to sum those values c <- a + b or sum(a, b)
To subtract one from the another c <- a - b
To multiply one with the another c <- a * b
To divide one from the another but to keep decimal part c <- a / b
To divide but to get round integer c <- ceiling(a,b) and c <- a%\%b
To get modulo number from division c <- a%%b
To calculate exponent c <- a ^ b
And finally some trigonometric functions sin(a), cos(a), tan(e), log(a)
If you prefer video tutorial, please check this one on YouTube
No comments:
Post a Comment