Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following two questions will mainly use if-else logic code: Q3(10 points) Given any number vectors, please write a short program to let R judge

image text in transcribed
The following two questions will mainly use if-else logic code: Q3(10 points) Given any number vectors, please write a short program to let R judge and print out odd or even for all numbers. For example: given A=c(4,2,2,1), write a program to let R give output: "even" "even" "even" "odd". You can input any numbers and set any length of the vector c(...),butthelengthshould be at least two numbers Q4(10 points) Suppose you have a vector of stock prices. Please write a short program to let R output "buy" or "sell" based on certain condition. For instance, suppose you have AAPL =C(109.49,109.90,109.11,109.95,111.03), write the program to judge decision. The threshold is that if the price is larger than 110.00 , R will show "sell", or it will show "buy". In this case, please write a program to let R judge and return "buy" "buy" "buy" "buy" "sell

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Value Buy Or Sell A Financial Advisory Practice

Authors: Mark C. Tibergien, Owen Dahl

1st Edition

1576601749, 978-1576601747

More Books

Students also viewed these Finance questions