Question: R language: Write the code in R Markdown and submit your R Markdown file here please. 1. Suppose you own stocks and watch the stock

R language: Write the code in R Markdown and submit your R Markdown file here please.
R language: Write the code in R Markdown and submit your R

1. Suppose you own stocks and watch the stock market every day, write a function in R named "stock_advice" to tell you whether you should sell your stocks under the following conditions using if-else conditional statements: If the stock market value from today is lower than that from the average of the past 3 days, return "buy" If the stock market value from today is higher than that from the average of the past 3 days, return "sell" If the stock market value from today is the same as the average of the past 3 days, return "watch" Include 4 arguments in your function: today's value, day 1 value, day 2 value and day 3 value. Note: to get the average of the past 3 days, use (day1+day2+day3)/3 Find the predicted decision if today's stock market value is $12.11, and the last 3 days values are $10.39, $15.98, and $13.96

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!