Get Tukey Five-Number Summaries in R (Example) | fivenum() Function

 

In this tutorial, I’ll illustrate how to calculate Tukey five-number summaries using the fivenum function in the R programming language.

The article consists of one example for the application of the fivenum function. To be more specific, the article will contain these topics:

So now the part you have been waiting for – the example.

 

Example Data

At first, I need to create some data that we can use in the examples below:

set.seed(5346744)
vec <- rnorm(100)
head(vec)
# [1] -1.83448649  0.28559301 -0.54080526 -0.39577168  0.05639552 -0.09803291

Have a look at the previous output of the RStudio console. It shows that the example data is a numeric vector containing randomly distributed values.

 

Example: Get Tukey Five-Number Summaries Using fivenum() Function

In this example, I’ll explain how to return the Tukey five-number summaries in R, i.e. the minimum, lower-hinge, median, upper-hinge, and maximum of a data object.

For this task, we can apply the fivenum function as shown below:

fivenum(vec)                     # Apply fivenum function
# [1] -2.6421637 -0.7640363 -0.1211748  0.3963059  2.3108042

The previous output shows the Tukey five-number summaries of our input vector.

 

Video, Further Resources & Summary

Would you like to learn more about the application of the fivenum function? Then you might want to have a look at the following video that I have published on my YouTube channel. In the video instruction, I’m explaining the R programming code of this tutorial:

 

The YouTube video will be added soon.

 

Furthermore, you may want to read the other articles on this website:

 

In this R tutorial you have learned how to apply the fivenum function to calculate descriptive statistics. In case you have additional questions or comments, let me know in the comments below. Furthermore, don’t forget to subscribe to my email newsletter in order to receive updates on new articles.

 

Subscribe to the Statistics Globe Newsletter

Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.


Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Top