How to obtain the maximum and minimum values from an array in R?
In R language, you can use the functions max() and min() to get the maximum and minimum values in an array.
For example, suppose there is an array x containing a set of numbers. To get the maximum and minimum values in this array, you can use the following code:
x <- c(1, 2, 3, 4, 5)
max_value <- max(x)
min_value <- min(x)
print(max_value) # 输出最大值
print(min_value) # 输出最小值
Running the above code will output the maximum and minimum values in array x.