#Write an R program to apply built-in statistical functions. [Hint: mean, median, standard deviation and others]
# Load the mtcars dataset
data(mtcars)
# Calculate the mean, median, and standard deviation of mpg
mpg_mean <- mean(mtcars$mpg)
mpg_median <- median(mtcars$mpg)
mpg_sd <- sd(mtcars$mpg)
# Print the results
cat("Mean MPG:", mpg_mean, "\n")
## Mean MPG: 20.09062
cat("Median MPG:", mpg_median, "\n")
## Median MPG: 19.2
cat("Standard Deviation of MPG:", mpg_sd, "\n")
## Standard Deviation of MPG: 6.026948
# Calculate the correlation between mpg and weight
mpg_weight_cor <- cor(mtcars$mpg, mtcars$wt)
# Print the correlation
cat("Correlation between MPG and Weight:", mpg_weight_cor, "\n")
## Correlation between MPG and Weight: -0.8676594