Obesity Rate of Male and Female in a Country - Engineering Assignment Help

Download Solution Order New Solution
Assignment Task :

The purpose of this assignment is to develop and assess your skills in R programming including summarising, wrangling and plotting data. Using the tidyverse package is recommended but not compulsory. Please read through the entire assignment and understand the submission format and marking rubrics before starting.

Part 1  
The spreadsheet titled ‘obesity.xlsx’ records the prevalence of obesity among adults in each country in the world. Each sheet is supposed to record the information of each country in each year including the average obesity rate and its 95% confidence interval of female, male and both groups. There were three years in the given dataset (2006, 2011, and 2016). Another sheet called Continent with information about countries in each continent is also given.

You will see that it is far from being ready for analysis and needs to be ‘wrangled’. Additionally, a few errors have been deliberately introduced so these will need to be corrected by applying your R code.
1.1. Explain why the data in its current form is not considered to be in ‘tidy’ format.  
1.2. Write a function that takes a year and outputs a dataframe with one or more rows, where each row shows the obesity rate of Male and Female in a country of that given year along with its 95% confidence interval values. The returned dataframe should have 6 columns (Country, Year, Sex, Rate, MinCI, MaxCI).
a) Load the data from the worksheet of the given year into a dataframe. 
b) Drop the column ‘Both sexes’. 
c) Add a new column named ‘Year’ filled all rows with the given year. 
d) Use the gather() function to transform the data in the two columns Male and Female to become rows. After this step, your dataframe now should have 4 columns: Country, Year, Sex, Rate.
e) Split the Rate column into 3 columns named Rate, MinCI, MaxCI. Your dataframe should have 6 after this step: Country, Year, Sex, Rate, MinCI, MaxCI  
f) Check and make necessary changes to make sure the data type of Rate, MinCI and MaxCI is numeric. Print the summary of the dataframe.  
g) Find and display rows with any invalid data, e.g. the rate value is not in the range of MinCI and MaxCI, MinCI is larger than MaxCI, etc. If they exist, change the MinCI and MaxCI values in these rows into NA. Print the summary of the dataframe. 
h) Return the dataframe
1.3. Apply the function to each of the three years in the data to obtain three datasets then combine the to form a single dataframe. Print the numbers of rows of the dataframe. 
1.4. Query the dataframe obtained in 1.3 to print the average obesity rates of Female and Male of each year. 
1.5. Sort the dataframe obtained in 1.3 and display the country name, year, sex and rate in descending of obesity rates. Write the result to a csv file.  
1.6. Load the data from the Continent worksheet into a dataframe, keeping only two columns, “Country or area” and “Continent”. 

 

 

This Engineering Assignment has been solved by our Engineering  Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.