Here we are explaining how to write an R program to test whether the elements of a given vector are greater than 25 or not. Here we are using the operator ’ > ’ for this finding. Checks if each element of the first vector is greater than the corresponding element of the second vector and returns the boolean value TRUE or FALSE. This operator is called a relational operator.
Below are the steps used in the R program to test whether the elements of a given vector are greater than 25. In this R program, we directly give the values to compare. Here using the relational operator each value of the vector is compared to check whether it is greater than the given value. The variable A is assigned with vector values. And the checking is done as like (A > 25).
A = c(27,26,9,7,10,0,14,30)
print("Original vector is:")
## [1] "Original vector is:"
print(A)
## [1] 27 26 9 7 10 0 14 30
print("Test whether the value > 25 or not:")
## [1] "Test whether the value > 25 or not:"
print(A > 25)
## [1] TRUE TRUE FALSE FALSE FALSE FALSE FALSE TRUE