R Programming: Test whether the value of the element of a given vector greater than 10 or not
R Programming: Vector Exercise-26 with Solution
Write a R program to test whether the value of the element of a given vector greater than 10 or not. Return TRUE or FALSE.
Sample Solution :
R Programming Code :
v = c(15,26,9,7,10,0,9,15)
print("Original vector:")
print(v)
print("Test whether the value > 10 or not:")
print(v > 10)
Sample Output:
[1] "Original vector:" [1] 15 26 9 7 10 0 9 15 [1] "Test whether the value > 10 or not:" [1] TRUE TRUE FALSE FALSE FALSE FALSE FALSE TRUE
R Programming Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a R program to combines two given vectors by columns, rows.
Next: Wrtie a R program to add 3 to each element in a given vector. Print the original and new vector.
Test your Programming skills with w3resource's quiz.
What is the difficulty level of this exercise?
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics