How to use range() function In R Language
We can use the range() function to get maximum and minimum values. Here we are calculating range values
Syntax:
range(vector/dataframe)
Example;
R
# create vector data = c (12, 45, NA , NA , 67, 23, 45, 78, NA , 89) # display print (data) # find range in vector print ( range (data, na.rm= TRUE )) |
Output:
[1] 12 45 NA NA 67 23 45 78 NA 89 [1] 12 89
How to Find the Range in R?
In this article, we will discuss how to find the Range in R Programming Language.
The range can be defined as the difference between the maximum and minimum elements in the given data, the data can be a vector or a dataframe. So we can define the range as the difference between maximum_value – minimum_value