Monday, June 11, 2018

Basics of R- Session 3- Basic Operations and Functions

R as Calculator
#Addition subtraction division and multiplication of numbers
2+3
## [1] 5
2-3
## [1] -1
2*3
## [1] 6
2/3
## [1] 0.6666667
2+9+8+8
## [1] 27
5-9+7*8
## [1] 52
# mathematical operator-   square, squaroot
x<-5
y<-4

sqrt(x+y)
## [1] 3
log(x)
## [1] 1.609438
log10(52)
## [1] 1.716003
exp(-x)
## [1] 0.006737947
#power  m^n

(x+y)^(1/3)
## [1] 2.080084
4^24
## [1] 2.81475e+14
~ tilde, “” quotation, | bar or pipe, ^ carat

No comments:

Post a Comment