Please write an R script that performs the following operations in the order listed. At the beginning of each task, write a comment marking the task number.
Name the file as: lab3-.R
1. Make the following packages available: tidyverse, ggpubr, rstatix (You need to install these packages if they haven’t been installed)
2. Download the ‘world happiness score.csv’ file from Blackboard. This dataset contains the ‘happiness score’, ‘health score’, ‘freedom score’, ‘trust score’ and several other scores of countries from 4 regions: Africa, AsiaPacific, Europe, and PanAmerica
3. Import ‘world happiness score.csv’ dataset and save it to a data frame named ‘happydata’. Check the structure of “happydata”
4. Browse and understand the data in each column
5. Central tendency: Calculate the mean, median, mode of Happiness.Score of all countries
6. Selecting cases: Calculate the mean, median, mode of Happiness.Score of ‘Europe’ countries.
7. Spread: Calculate the standard deviation, variance, min, max, range, and quantile for Happiness.Score
8. Use the sapply() function to calculate the mean and standard deviation for all numeric variables.
9. Use the summary() function to get a summary statistics for the entire dataset
10. Use the pipes operator to calculate the mean and standard deviation of Happiness.Score for different regions. What do you learn from the result? (Answer this question using the # comment).
Submission:
Submit the r script file to Blackboard via the Lab3 submission link.