Starting from:

$34.99

DSE5002 Week 2 Exercises Solution

Your Name Here
Place this at the top of your script: library(stringr) library(lubridate) library(forcats)
Exercise 1
Read the sales_pipe.txt file into an R data frame as sales.
# Your code here
Exercise 2
Note: You will need to assign the first element of colnames to a single character.
# Your code here
Exercise 3
Note: Use lubridate
# Your code here
Exercise 4
What is the average number of days it takes to ship an order?
# Your code here
1
Exercise 5
How many customers have the first name Bill? You will need to split the customer name into first and last name segments and then use a regular expression to match the first name bill. Use the length() function to determine the number of customers with the first name Bill in the sales data.
# Your code here
Exercise 6
How many mentions of the word ‘table’ are there in the Product.Name column? Note you can do this in one line of code
# Your code here
Exercise 7
Create a table of counts for each state in the sales data. The counts table should be ordered alphabetically from A to Z.
# Your code here
Exercise 8
Create an alphabetically ordered barplot for each sales Category in the State of Texas.
# Your code here
Exercise 9
Find the average profit by region. Note: You will need to use the aggregate() function to do this. To understand how the function works type ?aggregate in the console.
# Your code here
Exercise 10
Find the average profit by order year. Note: You will need to use the aggregate() function to do this. To understand how the function works type ?aggregate in the console.
# Your code here
2

More products