Question: Please finish it in R language the dataframe should be called msft 1. Write a function called calculateret() to calculate the daily return. This function

Please finish it in R language

the dataframe should be called msft

1. Write a function called calculateret() to calculate the daily return. This function should have two arguments: msft(a data.frame object) and MSFT.Adjusted.

Daily return equals (closing price-opening price)/opening price

Call these returns retmsft

(This function should extract the prices for the variable indicated by MSFT.Adjusted and output the simple daily return from those prices. Please provide your function.)

2. To remove any NA's in retmsft, the code should be?

3. The mean of retmsft is? The sd of retmsft is?(solve in code)

MSFT.Open MSFT.High MSFT.Low MSFT.Close MSFT.Volume MSFT.Adjusted
1 12 13 11 12 10000 13
2 12 15 11 14 12000 14
3 13 16 9 15 10000 12
4 14 17 10 12 20000 11
5 12 14 11 13 3000 15

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 Mathematics Questions!