Wednesday, 4 October 2023

Slip1-Big Data-Write an R program to find the maximum and the minimum value of a given vector.

 

Write an R program to find the maximum and the minimum value of a given vector.

nums = c(50 60 70 80 90 100)

print('Original vector:')

print(nums)  

print(paste("Maximum value of the said vector:",max(nums)))

print(paste("Minimum value of the said vector:",min(nums)))

 Output:-

> nums = c(50,60,70,80,90,100)

> print('Original vector:')

[1] "Original vector:"

> print(nums)  

[1] 50 60 70 80 90 100

> print(paste("Maximum value of the said vector:",max(nums)))

[1] "Maximum value of the said vector: 100"

> print(paste("Minimum value of the said vector:",min(nums)))

[1] "Minimum value of the said vector: 50"