BUS5DWR Data Wrangling and R Assignment

Assignment Help Other Subject
Reference no: EM132575317

BUS5DWR Data Wrangling and R Assignment - La Trobe University, Australia

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 columns 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 rows 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 order 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".

1.7. Check if there is any country in the dataframe obtained in (1.3) not in the country list loaded in (1.6). Display the country names if any (no duplicates).

1.8. Display the average obesity rate of Female in Europe and North America.

Part 2 -

The online hospitality company Airbnb has made publicly available a number of datasets. This part of the assignment makes use of a subset of the Melbourne dataset. The dataset is given in the AirBnBMel6500.tsv file.

It consists of a number of parameters related to properties available for lodging in the Melbourne metropolitan area and can be visualised.

Write R code to answer the following.

2.1. Load the dataset from the given file into a dataframe. Change the column name to remove spaces. Observe the data and report whether the type of each column is appropriate or not to the data.

2.2. How many listings and unique locations in the dataframe?

2.3. Keep only the listings that have the last review in 2019 in a dataframe. Remove all the others. Print the number of remained listings and unique locations.

2.4. Display the number of listings of the three most popular property type, excluding listings with missing property type.

2.5. Remove the country name (Australia) in the location column.

2.6. Find the average price of listings in Carlton.

2.7. Find the top ten locations that have the highest average price. Display the name and the average price in its descending order.

2.8. Display the listing ID and location of listings that its transport description mentions both words university and supermarket with upper or lower case or mixed in any order.

2.9. Suppose somebody wants to choose a listing based on the following criteria. Write a function that inputs a listing id and returns a score that is the sum of points as below:

a. Points for price: (200 minus price) but not less than zero

b. (Review score rating minus 100)

c. Points by popularity based on the number of reviews: 100 if at least in the first quartile, 0 if less than the median value, 50 otherwise.

2.10. Which listing ID has the highest score according to the above criteria?

Reference no: EM132575317

Questions Cloud

The internet change consumer and supplier relationships : It has been said that there is no such thing as a sustainable strategic advantage. How does the Internet change consumer and supplier relationships?
Identify revenue streams for the group proposed solution : Identify revenue streams for the group's proposed solution, including the unit and volume being sold, and the price each unit will sell for.
Business operations data set : Select a business operations data set from the internet or other sources which can be used for forecasting.
Alliance supermarket : Alliance Supermarkets has been using a point-of-sale system for some time to track its inventory. Describe any information that may help Alliance reduce cost
BUS5DWR Data Wrangling and R Assignment : BUS5DWR Data Wrangling and R Assignment Help and Solution - La Trobe University, Australia - Assessment Writing Service
Which is struggling in your community : Choose a business in the media having difficulties with its operating model or one which is struggling in your community.
Explain how you would manage client diverse needs : Explain how you would manage client's diverse needs, including his co-occurring disorders. Describe a treatment plan for client, including how you would.
Define and explain biofeedback in your own words : Define and explain biofeedback in your own words. Describe who uses biofeedback and EEG biofeedback and why (detail at least two professions and purposes).
Has been enough or should the fed do more : What is your take on it? Has it been enough or should the Fed do more? provide a summary of the recent response of the Federal to the Coronavirus Crisis

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd