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).
STEP 1: Assign variable A with vector values
STEP 2: First print original vector values
STEP 3: check the vector values are greater than 25 as (A> 25)
STEP 4: print TRUE or FALSE as per comparison
A= c(27,26,9,7,10,0,14,30) print("Original vector is:") print(A) print("Test whether the value > 25 or not:") print(A> 25)
 "Original vector is:"  27 26 9 7 10 0 14 30  "Test whether the value > 25 or not:"  TRUE TRUE FALSE FALSE FALSE FALSE FALSE TRUE