Question: Use R language to solve the problem and the stocks dataset with the weekly closing values for the year 2021 initialized as shown below: stocks
Use R language to solve the problem and the stocks dataset with the weekly closing values for the year 2021 initialized as shown below:
stocks
1. Store the correlation matrix in the variable cm. Using loops, for each stock in the dataset, show the top 3 correlated stocks for that respective stock. The code should work for any dataset with any number of stocks. Sample output for the given dataset is shown below:

Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
