# How to Calculate Descriptive statistics using R – R tutorial

289
In this post, I will explain how to calculate basic descriptive statistics using R. The following R scripts helps to calculate descriptive statistics such as Mean, Median, Mode, Standard deviation, Standard error of the mean, Five-number summary, quartiles, percentiles, skewness and kurtosis.
Packages used are psych and Desctools
```##Descriptive statistics using R##
##Packages used psych and Desctools
##Following commands will install the packages only if they are not already installed
if(!require(psych)){install.packages("psych")}
if(!require(DescTools)){install.packages("DescTools")}
data("trees") ##loads data inbuilt in dataset package of R which includes Girth, Height and Volume for Black Cherry Trees
##structure of the data frame
str(trees)
##summary
summary(trees)
##mean
mean(trees\$Height)
##median
median(trees\$Height)
##mode
Mode(trees\$Height)
##Standard deviation
sd(trees\$Height)
##Standard error of the mean
sd(trees\$Height) / sqrt(length(trees\$Height))
##Five-number summary, quartiles, percentiles
summary(trees\$Height)
##skewness and kurtosis
describe(trees\$Height,type=3) #there are 3 options available u can see in package documentation for details```
You can find the script and download in Github Descriptive Statistics in R. Share and Subscribe to SAR Publisher via Email for more interesting updates.