Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started