Question: RGui Using R for Data Analysis and Graphics 2.11 Exercises 1. For each of the following code sequences, predict the result. Then do the computation:

RGui "Using R for Data Analysis and Graphics"

2.11 Exercises

1. For each of the following code sequences, predict the result. Then do the computation: a) answer <- 0 for (j in 3:5){ answer <- j+answer } b) answer<- 10 for (j in 3:5){ answer <- j+answer } c) answer <- 10 for (j in 3:5){ answer <- j*answer }

2. Look up the help for the function prod(), and use prod() to do the calculation in 1(c) above. Alternatively, how would you expect prod() to work? Try it!

3. Add up all the numbers from 1 to 100 in two different ways: using for and using sum. Now apply the function to the sequence 1:100. What is its action?

4. Multiply all the numbers from 1 to 50 in two different ways: using for and using prod.

6.Uses apply() to apply the functionis.factor to each column of the suppliers data frame tinting. For each of the columns that are identified as factors, determine the levels. Which columns are ordered factors? [Use is.ordered()].

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!