ALY2010 Project 1 Assignment
Grade: 50 points
Install the latest versions of R and R Studio.
Prepare the following report using an R script file.
At the beginning of the R Script file, enter your information using hashtags (#) (this indicates non-coding text), example
elow.
When you prepare and present each task on your R Script file, use The task number and the title I provide in red until
the first dot.
Task 1: Create a vector named car_speed.
Use the vector to enter the car speed data from table 1. Enter only the speed data, not the record numbers.
Task 2: Obtain the average speed.
Create an object to store the mean value.
Then present the value using the print(paste()) code combination.
Inside the paste() code enter text with quotations and objest without the quotations, here is an example to help you
with your first code: print(paste("The mean speed value is", meanSpeed, "mph"), quote = FALSE)
Use code round() to present the result using only two decimals.
Task 3: Obtain the standard deviation.
Create an object to store the value and present it using the print(paste()) code combination. Use code round() to
present the result using only two decimals.
Task 4: Obtain the median speed.
Create an object to store the value and present it using the print(paste()) code combination. Use code round() to
present the result using only two decimals.
Task 5: Obtain the 90th quantile.
Quantiles can be obtained with code quantile(objectName, 0.90) , use the print(paste()) code combination to present it.
Task 5: Obtain the 25th quantile.
Create an object to store the value and present it using the print(paste()) code combination. Use.
Task 6. Vectors, Matrix and Table
Using vectors, then matrix, create a table to present the values of mean, standard deviation, median, 90th and 25th
quantiles (with the objects names you created above).
Task 7: Delete values.
Delete the last value from your vector car_speed. Name the new vector car_speed2.
Task 8. Obtain mean from vector 2
Create an object to store the value of the new mean and present it using the print(paste()) code combination.
Task 9: Adding values.
Add the value 55.35 mph to the vector car_speed2, name the new vector car_speed3.
Task 10. Obtain mean from vector 3
Create an object to store the value of the new mean and present it using the print(paste()) code combination.
Task 11: Create vector sales.
Create a vector named “sales” to store the following data: 180, 250, 440, 620, 730, 710, 510
Task 12: Create vector days.
Create a vector named “days” to store the days of the week in the following order:
“Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday”
Task 13: Link the days of the week with the sale values.
Check my website https:
pubs.com/Dee_Chiluiza/vectors_matrix and in section 7, observe how to Apply names to
columns and rows.
Task 14: Present vector sales again
Vector sales now should include the names of the columns.
Task 15: Create vector with name: good_sales.
Enter the co
esponding code to identify in which days of the week the sales were higher than $500.
Hint: TRUE and FALSE outcomes.
Task 16. Sum total sales
Present the sum of vector sales
Task 17. Sum good sales
Present the sum of good sales, days with sales above $500.
https:
pubs.com/Dee_Chiluiza/vectors_matrix
Translate formulas into R codes
If the values of A, B and C in the formula before are: 20, 35, and 40, the formula is translated into R codes as follows.
A = 20
B = 35
C = 40
formula = (A + B^2)/sqrt(C)
print(paste(“Value of formula is”, formula).
Translate the following formula and obtain the co
esponding value:
Task 19. Working with Matrix.
Using the matrix strategy presented in the file “Vectors and Matrices.R” in CANVAS Modules, and in my website
https:
pubs.com/Dee_Chiluiza/vectors_matrix , enter the data from the table below into your R Script file, and present
the matrix.
What you need to present.
Present the R script file using the assignment link.
https:
pubs.com/Dee_Chiluiza/vectors_matrix