Working with univariate descriptive statistics in R
Uni means one and dealing with one variable for looking into data in univariate descriptive statistics, describes a single variable for unit analysis, which is also the simplest form of quantitative analysis. To find the pattern or find the meaning in data in cases of univariate analysis use central tendencies such as mean, median, mode, range, variance, maximum, minimum, and standard deviation. Bar charts, histograms, pie charts, and frequency polygons are the best option for representing the univariate data. In this recipe, we introduce some basic functions used to describe a single variable.
Getting ready
We need to apply descriptive statistics to a sample data. Here, we use the built-in mtcars
data as our example.
How to do it...
Perform the following steps:
- First, load the
mtcars
data into a DataFrame with a variable namedmtcars
:
> data(mtcars)
- To obtain the vector range, the
range
function will return the lower and upper bound of the...