Summary Statistics in R: Mean, Standard Deviation, Frequencies, and more: (R Tutorial 2.7)
In this video you will learn different ways to summarize numeric and categorical variables in R.
Here we will show you how to summarize a categorical variable in R in two ways:
1- by producing frequency table using "table" command; here you will also learn to express the frequency table in R using proportion and ask for the number of observations using the "length" command.
2- by producing a two-way table or contingency table using "table" command.
Next, you will learn to summarize a numeric variable in R by:
1-calculaing the mean and trimmed mean in R using "mean" command and "trim" argument
2-calculating the median using the "median" command
3- calculating the variance using "var" command
4- calculating the standard deviation using the "sd" command or "sqrt" command (taking square root of variance)
5- calculating the minimum, maximum and range in R using "min", "max" and "range" commands
6- calculating specific quantiles or percentiles in R using the "quantile" command and "probs" argument
7- calculating Pearson's correlation using the "cor" command
8- calculating Spearman's correlation using the "cor" command and "method" argument
9- calculating the covariance in R using the "cov" or "var" command
And finally you will learn to to summarize all data (both numeric and categorical) in R using the "summary" command.
We recommend using the link below to download the dataset and practice on your own while watching this tutorial.
You can access and download the dataset that was used in this tutorial here: