Question: R PROGRAMMING LANGUAGE_________________ Initialize the Dow Jones Industrials daily closing data as shown below: dow a) Use the diff function to calculate the differences between
R PROGRAMMING LANGUAGE_________________ Initialize the Dow Jones Industrials daily closing data as shown below: dow
a) Use the diff function to calculate the differences between consecutive values. Insert the value 0 at the beginning of these differences. Add this result as the DIFFS column of the data frame .
b) How many days did the Dow close higher than its previous day value? How many days did the Dow close lower than its previous day value? c) Show the subset of the data where there was a gain of at least 400 points from its previous day value.
d) Provide the solution to compute the longest gaining streak of at least 100 points in the data. Show the data for that longest gaining streak. Hint: Use the rle function provided by R .
THE SCREENSHOT PROVIDES THE SAMPLE OUTPUT FOR C AND D

c) Show the subset of the data where there was a gain of at least 400 points from its previous day value. DATE VALUE DIFFS 25 2/6/18 24913 567 29 2/12/18 24601 410 47 3/9/18 25336 441 d) Provide the solution to compute the longest gaining streak of at least 100 points in the data. Show the data for that longest gaining streak. Hint: Use the rle function provided by FR DATE VALUE DIFFS STREAK 36 2/22/18 24962 164 Y 37 2/23/18 25310 348 38 2/26/18 25709 399Y
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
