Question: Write a simple R program in an R-script file that will: Read the data in the file 'AAPL_2021.csv' uploaded to Canvas. This is the 2021

Write a simple R program in an R-script file that will:

Read the data in the file 'AAPL_2021.csv' uploaded to Canvas. This is the 2021 year-to-date stock price of Apple, Inc with a header row.

Plot the 'Close/Last' price for every day as a line plot.

Plot the 'Volume' for every day as a bar plot - preferably on the same plot as #2.

Calculate the Average and Median closing price of the stock as well as the volume of shares traded for 2021 for this stock.

Run your script file in RStudio and take appropriate screenshots showing the results for #2, 3 and 4.

Hints:

To remove the "$" signs from the stock price column, use "price_without_sign <- as.numeric(gsub("\\$", "", price))".

To plot both a bar plot and a plot on the same chart, refer to the lecture "06 Basic Data Visualizations" which has an example with two plots on the same chart.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!