留学生作业代写 BUSI2045 – Homework 2

BUSI2045 – Homework 2
Note: You need to show your full R codes and results in your solutions. (You may use the “Compile Report” function under Menu “File” in RStudio to generate a Word/PDF report of both R codes and results)
Question 1 (60 Points)
Read the file Assignment_2_Q1.csv into R and answer following questions:

Copyright By PowCoder代写 加微信 powcoder

(a) How many observations in this data set? What are the types (numeric, integer, etc.) of these variables?
(b) Which variable(s) belong to the discrete variable? Check the unique values for these discrete variables.
(c) Which variable(s) belong to the continuous variable? Check the values of mean, standard deviation, and range for these continuous variables.
(d) Construct a frequency table as below.
Hints: You may inspect the dataset to find suitable variables first. Ignore the order of the columns and rows.
North South West East High 12 7 10 11
Medium ? ? ? ? Low ? ? ? ?
(e) Is variable X4 normal distributed? Use ggplot2 to create a QQ plot to help answer this question.
(f) Recreate the following boxplot for variable X3. The result should look like the below.
Hint: you may need to construct a new subset that only includes “High” and “Low” before plotting.

(g) Recreate a histogram from a new variable X6 as below, where X6 is the sum of X3 and X4. Hints: (i.) There are two layers in total, including a histogram, and a vertical line at mean of X6.
Question 2: Data Analytics and Visualization – Application (40 Points)
(a) Read the file marketing_campaign.csv in R, and construct a subset where the variable Income contains no missing value, and variables NumStorePurchases and NumWebPurchases are not equal to 0. How many observations and variables are in this dataset?
Answer the following questions based on this new dataset.
(b) What are the values of 10%, 50%, 80% percentile for variable Income?
(c) Write a named function and apply that function to three variables (i.e., Income, NumStorePurchases and NumWebPurchases) in the dataset, to compute the ratio of each value (row) against the maximum value of the variable. Please save the result in an object and display the first 6 rows only.
Hint: you may need to use apply() and head() functions.
(d) Write anonymous function to solve the above question. Please also save the result in an object and display the first 6 rows only.

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com