Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Only answer all of part B in R. Give the R commands. Write an explicit stacked set of if statements that does the same thing

Only answer all of part B in R. Give the R commands. image text in transcribedimage text in transcribedimage text in transcribed

Write an explicit stacked set of if statements that does the same thing as the integer version of the switch function illustrated earlier. Test it with mynum dosage [1] 10.0 60.0 60.0 60.0 10.0 25.3 25.3 ii. Using the same lowdose, meddose, and highdose thresholds as in (i), given doselevel dosage [1] 25.0 25.0 25.0 83.4 25.0 83.4 83.4 Also, doselevel has been overwritten as follows: R> doselevel [1] Small Small Small Large Small Large Large Levels: Small Large iii. Given lowdose dosage [1] 9 49 49 Also, doselevel has been overwritten as follows: R> doselevel 1] Small Large Large Levels: Small Large iv. Using the same lowdose, meddose, and highdose thresholds as (iii), as well as the same doselevel as (i), the result of dosage after running the nested if statements is as follows: R> dosage [1] 4.5 91.5 91.5 91.5 4.5 26.0 26.0 Assume the object mynum will only ever be a single integer between 0 and 9. Use ifelse and switch to produce a command that takes in mynum and returns a matching character string for all possible values 0, 1, ..., 9. Supplied with 3, for example, it should return "three"; supplied with o, it should return "zero", Write an explicit stacked set of if statements that does the same thing as the integer version of the switch function illustrated earlier. Test it with mynum dosage [1] 10.0 60.0 60.0 60.0 10.0 25.3 25.3 ii. Using the same lowdose, meddose, and highdose thresholds as in (i), given doselevel dosage [1] 25.0 25.0 25.0 83.4 25.0 83.4 83.4 Also, doselevel has been overwritten as follows: R> doselevel [1] Small Small Small Large Small Large Large Levels: Small Large iii. Given lowdose dosage [1] 9 49 49 Also, doselevel has been overwritten as follows: R> doselevel 1] Small Large Large Levels: Small Large iv. Using the same lowdose, meddose, and highdose thresholds as (iii), as well as the same doselevel as (i), the result of dosage after running the nested if statements is as follows: R> dosage [1] 4.5 91.5 91.5 91.5 4.5 26.0 26.0 Assume the object mynum will only ever be a single integer between 0 and 9. Use ifelse and switch to produce a command that takes in mynum and returns a matching character string for all possible values 0, 1, ..., 9. Supplied with 3, for example, it should return "three"; supplied with o, it should return "zero

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

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

What are the functions of top management?

Answered: 1 week ago

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

Why should a business be socially responsible?

Answered: 1 week ago

Question

Discuss the general principles of management given by Henri Fayol

Answered: 1 week ago