Professional Documents
Culture Documents
Answers Lab1 R Answers Lab1 R
Answers Lab1 R Answers Lab1 R
Answers Lab1 R
Name:
Lab 1 – R Language ID:
1. Download the “yearly_sales.csv” file from CANVAS
2. Open the csv file using a spreadsheet program. What is the csv file?
The csv file contains the sales information for different customers with the customer ID, total sales
amount, number of sale orders, and customer genter.
A scatterplot between the number of sale orders and total sales amount.
8. Type the following commands. What have you done to the “sales” data?
sales$per_order <- sales$sales_total/sales$num_of_orders
head(sales)
An average sales amount column has been added for each customer.
A text file has been generated containing the modified sales data in the same directory.
dev.off()
A histogram file "sales_hist.jpeg" has been generated for number of sales order in the same directory.
The total sales amount column has been stored as the x vector while the number of sale order column
has been stored as the y vector.
12. Type the commands in the leftmost column and fill in the following table:
R Command Return Value Semantic Meaning (hint: use the help panel in RStudio)
cor(x,y) 0.7508015 To produce the correlation between x and y
13. Apply the R knowledge you have learned in the previous steps to the dataset “zipIncome.csv” in
CANVAS and state your data analytics insights in less than 50 words.
(Open Answers)
14. This is the end; please hand in your lab sheet to the tutor or person-in-charge for taking lab participation.
Once your lab sheet is accepted, please feel free to leave quietly.