Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to do the following or type it in R studio. Thanks in advance! 1 ) Write an R script to practice the if -

How to do the following or type it in R studio. Thanks in advance!
1) Write an R script to practice the if-else command, for two
alternatives. For alternative 1 compute the sum of 1,3, and 5. For
alternative 2 compute the product of 2 and 4. Define the alternative
by choosing the value of variable X at the beginning of the code,
and check X by using if to decide which alternative to compute.
2) Write an R script to practice the while command. Use a while
loop, which prints the elements of the sequence 2,4,6,...,20. Use
the start value 2, and increment the index by 2 in the loop.

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

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions