13 Feb R Min and Max
We can easily find the minimum and maximum values from a vector or set or dataframe using the min() and max() functions respectively. Let us learn about them with examples.
R min
To return the minimum value of a vector or set or dataframe, use the min() function in the R programming language. Let us see an example:
# Create a Vector # Marks of a student in various subjects marks <- c(95, 99, 90, 85, 87, 92) # Find the minimum value from the vector res <- min(marks) res
Output
[1] 85
R max
To return the maximum value of a vector or set or dataframe, use the max() function in the R programming language. Let us see an example:
# Create a Vector # Marks of a student in various subjects marks <- c(95, 99, 90, 85, 87, 92) # Find the maximum value from the vector res <- max(marks) res
Output
[1] 99
If you liked the tutorial, spread the word and share the link and our website Studyopedia with others.
For Videos, Join Our YouTube Channel: Join Now
Read More:
No Comments