Find the maximum and minimum number in R Programming Language

Find the maximum and minimum number in R

Maxima and Minima:

Maximum Value:

The maximum value of a function or a dataset is the highest value it takes. In mathematical terms, if you have a function , the maximum value, denoted as , is the largest output that the function can produce within a given range.

Minimum Value:

Conversely, the minimum value is the lowest value a function or dataset can take. For a function , the minimum value, denoted as , is the smallest output within a specified range.

How to Find Maxima and Minima in R Programming language:

Using Functions:

In R, you can find the maximum and minimum values of a vector or a dataset using the max() and min() functions, respectively.

For example:

Input:

x <- c(2 ,3 ,4 ,6,1) 
min(x)
y <- c(78,34,5,67,41,33)
max(y)

Output:

$Rscript main.r
[1] 1
[1] 78 

Conclusion:

In conclusion, maxima and minima represent the extreme values of a function or dataset. In R, you can find these values using the max() and min() functions, and visualizing your data through plots can provide a clearer understanding of the distribution and location of these extrema. Whether you are working with mathematical functions, statistical analysis, or data visualization, understanding maxima and minima is crucial for gaining insights into the behavior of your data.

Scroll to Top