Write function that takes a year & outputs a data frame

Write function that takes a year & outputs a data frame

[ad_1]

1.1. Explain why the data in its current form is not considered to be in ‘tidy’ format. (1 mark)
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. (1 mark)
b) Drop the column ‘Both sexes’. (1 mark)
c) Add a new column named ‘Year’ filled all rows with the given year. (1 mark)
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.
(2 marks)
e) Split the Rate column into 3 columns named Rate, MinCI, MaxCI. Your dataframe should have 6
columns after this step: Country, Year, Sex, Rate, MinCI, MaxCI (2 marks)
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. (1 mark)
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.

[Button id=”1″]

[ad_2]

Source link

"96% of our customers have reported a 90% and above score. You might want to place an order with us."

Essay Writing Service
Affordable prices

You might be focused on looking for a cheap essay writing service instead of searching for the perfect combination of quality and affordable rates. You need to be aware that a cheap essay does not mean a good essay, as qualified authors estimate their knowledge realistically. At the same time, it is all about balance. We are proud to offer rates among the best on the market and believe every student must have access to effective writing assistance for a cost that he or she finds affordable.

Caring support 24/7

If you need a cheap paper writing service, note that we combine affordable rates with excellent customer support. Our experienced support managers professionally resolve issues that might appear during your collaboration with our service. Apply to them with questions about orders, rates, payments, and more. Contact our managers via our website or email.

Non-plagiarized papers

“Please, write my paper, making it 100% unique.” We understand how vital it is for students to be sure their paper is original and written from scratch. To us, the reputation of a reliable service that offers non-plagiarized texts is vital. We stop collaborating with authors who get caught in plagiarism to avoid confusion. Besides, our customers’ satisfaction rate says it all.

© 2022 Homeworkcrew.com provides writing and research services for limited use only. All the materials from our website should be used with proper references and in accordance with Terms & Conditions.

Scroll to Top