To make an R program for testing whether the elements of a given vector are greater than 25, we are using the operator ' > '. Now we have to check 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 depending upon the result. This operator is called a relational operator.
In this R program, We print the original vector values first, then we directly give the values to compare, using the relational operator. Each value of the vector is compared and checked whether it is greater than the given value. The variable A is assigned vector values and the checking is done as (A> 25).
STEP 1: Assign variable A with vector values
STEP 2: First print the original vector values
STEP 3: Check the vector values are greater than 25 as (A> 25)
STEP 4: Print TRUE or FALSE as per the 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)
[1] "Original vector is:" [1] 27 26 9 7 10 0 14 30 [1] "Test whether the value > 25 or not:" [1] TRUE TRUE FALSE FALSE FALSE FALSE FALSE TRUE