# 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:

- summary Function in R
- Compute Summary Statistics by Group
- R Commands List
- Introduction to R Programming

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.