R&b Songs About Being Scared to Love Again
R - Operators
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. R language is rich in built-in operators and provides post-obit types of operators.
Types of Operators
We have the following types of operators in R programming −
- Arithmetic Operators
- Relational Operators
- Logical Operators
- Assignment Operators
- Miscellaneous Operators
Arithmetic Operators
Following table shows the arithmetic operators supported by R linguistic communication. The operators human activity on each chemical element of the vector.
| Operator | Clarification | Example |
|---|---|---|
| + | Adds two vectors | Live Demo five <- c( two,5.five,6) t <- c(8, three, 4) print(v+t) it produces the post-obit effect − [1] x.0 8.v 10.0 |
| − | Subtracts 2d vector from the first | Live Demo five <- c( 2,5.5,6) t <- c(viii, iii, 4) print(five-t) information technology produces the following effect − [1] -vi.0 2.v ii.0 |
| * | Multiplies both vectors | Live Demo v <- c( two,5.5,vi) t <- c(eight, 3, 4) print(v*t) it produces the following result − [1] 16.0 16.v 24.0 |
| / | Divide the first vector with the 2d | Alive Demo v <- c( 2,v.5,6) t <- c(8, 3, four) print(v/t) When we execute the above lawmaking, it produces the post-obit result − [ane] 0.250000 ane.833333 1.500000 |
| %% | Give the remainder of the first vector with the 2d | Live Demo five <- c( 2,v.five,6) t <- c(8, 3, 4) print(v%%t) it produces the following result − [1] two.0 2.5 2.0 |
| %/% | The issue of sectionalisation of start vector with second (quotient) | Live Demo 5 <- c( ii,5.v,6) t <- c(8, 3, 4) print(5%/%t) it produces the following result − [1] 0 1 1 |
| ^ | The first vector raised to the exponent of second vector | Alive Demo v <- c( 2,5.v,6) t <- c(eight, 3, 4) print(v^t) it produces the following result − [1] 256.000 166.375 1296.000 |
Relational Operators
Following tabular array shows the relational operators supported by R language. Each element of the showtime vector is compared with the corresponding element of the second vector. The result of comparison is a Boolean value.
| Operator | Description | Example |
|---|---|---|
| > | Checks if each chemical element of the beginning vector is greater than the corresponding element of the second vector. | Alive Demo five <- c(2,five.5,vi,9) t <- c(viii,2.v,14,9) print(v>t) it produces the following result − [1] Imitation True Fake FALSE |
| < | Checks if each element of the get-go vector is less than the respective element of the second vector. | Alive Demo 5 <- c(ii,5.5,six,9) t <- c(eight,2.5,14,nine) print(v < t) it produces the following event − [1] TRUE Simulated True Simulated |
| == | Checks if each element of the starting time vector is equal to the corresponding element of the second vector. | Alive Demo v <- c(2,five.5,6,nine) t <- c(8,2.v,14,ix) print(v == t) information technology produces the following result − [1] Imitation False Faux TRUE |
| <= | Checks if each element of the first vector is less than or equal to the corresponding element of the 2nd vector. | Live Demo v <- c(two,v.v,six,ix) t <- c(8,ii.v,14,nine) print(v<=t) it produces the following result − [i] Truthful Imitation True TRUE |
| >= | Checks if each chemical element of the first vector is greater than or equal to the corresponding element of the second vector. | Live Demo five <- c(ii,5.5,half dozen,9) t <- c(8,2.5,14,9) print(v>=t) it produces the post-obit result − [1] Faux TRUE FALSE TRUE |
| != | Checks if each element of the first vector is unequal to the corresponding chemical element of the 2d vector. | Live Demo v <- c(2,5.5,half-dozen,ix) t <- c(8,2.5,xiv,9) print(5!=t) it produces the following outcome − [ane] True Truthful Truthful FALSE |
Logical Operators
Post-obit table shows the logical operators supported by R language. Information technology is applicable simply to vectors of type logical, numeric or complex. All numbers greater than one are considered equally logical value Truthful.
Each element of the showtime vector is compared with the respective element of the second vector. The result of comparison is a Boolean value.
| Operator | Description | Example |
|---|---|---|
| & | Information technology is chosen Element-wise Logical AND operator. It combines each chemical element of the first vector with the respective element of the second vector and gives a output True if both the elements are TRUE. | Alive Demo 5 <- c(three,i,Truthful,2+3i) t <- c(4,1,Faux,2+3i) print(v&t) it produces the following outcome − [i] Truthful TRUE FALSE Truthful |
| | | It is called Element-wise Logical OR operator. It combines each element of the outset vector with the corresponding element of the 2d vector and gives a output Truthful if one the elements is Truthful. | Live Demo five <- c(3,0,TRUE,2+2i) t <- c(4,0,FALSE,2+3i) print(five|t) it produces the following upshot − [1] Truthful Simulated True Truthful |
| ! | It is called Logical Not operator. Takes each element of the vector and gives the opposite logical value. | Live Demo v <- c(three,0,True,2+2i) print(!5) it produces the following result − [ane] Fake TRUE FALSE FALSE |
The logical operator && and || considers simply the get-go element of the vectors and requite a vector of single element as output.
| Operator | Description | Example |
|---|---|---|
| && | Called Logical AND operator. Takes beginning element of both the vectors and gives the TRUE only if both are TRUE. | Live Demo v <- c(3,0,TRUE,2+2i) t <- c(1,3,Truthful,2+3i) print(v&&t) it produces the following issue − [1] True |
| || | Called Logical OR operator. Takes first element of both the vectors and gives the True if one of them is TRUE. | Alive Demo 5 <- c(0,0,True,two+2i) t <- c(0,3,TRUE,2+3i) print(v||t) information technology produces the following consequence − [ane] FALSE |
Assignment Operators
These operators are used to assign values to vectors.
| Operator | Clarification | Example |
|---|---|---|
| <− or = or <<− | Called Left Assignment | Alive Demo v1 <- c(3,ane,True,2+3i) v2 <<- c(3,ane,Truthful,two+3i) v3 = c(3,1,TRUE,2+3i) print(v1) print(v2) print(v3) information technology produces the following result − [1] three+0i 1+0i one+0i 2+3i [one] 3+0i 1+0i one+0i 2+3i [1] iii+0i i+0i 1+0i 2+3i |
| -> or ->> | Called Right Assignment | Alive Demo c(three,one,TRUE,2+3i) -> v1 c(3,ane,TRUE,2+3i) ->> v2 print(v1) print(v2) it produces the following result − [1] three+0i one+0i one+0i two+3i [1] 3+0i 1+0i 1+0i 2+3i |
Miscellaneous Operators
These operators are used to for specific purpose and not full general mathematical or logical computation.
| Operator | Clarification | Example |
|---|---|---|
| : | Colon operator. It creates the series of numbers in sequence for a vector. | Alive Demo 5 <- two:8 print(v) it produces the following result − [1] ii iii 4 5 6 vii 8 |
| %in% | This operator is used to identify if an chemical element belongs to a vector. | Live Demo v1 <- 8 v2 <- 12 t <- 1:ten print(v1 %in% t) print(v2 %in% t) it produces the following result − [one] Truthful [1] FALSE |
| %*% | This operator is used to multiply a matrix with its transpose. | Live Demo M = matrix( c(ii,6,5,1,10,four), nrow = two,ncol = iii,byrow = Truthful) t = One thousand %*% t(Thou) print(t) it produces the following result − [,1] [,2] [1,] 65 82 [two,] 82 117 |
Useful Video Courses
Video
Video
Video
Video
Video
Video
hallidayponot1941.blogspot.com
Source: https://www.tutorialspoint.com/r/r_operators.htm
0 Response to "R&b Songs About Being Scared to Love Again"
إرسال تعليق