Question: The variable i varies over the first 3 rows of the third column of the iris dataset. This dataset is built into R, and
The variable i varies over the first 3 rows of the third column of the iris dataset. This dataset is built into R, and those specific values are 1.4, 1.4, 1.3. e) for (j in c(1, 2, 3, 4, 5)) { (2 points) The variable i is not a for loop variable (note the for loop is over j). In addition, the body is not syntactically correct (missing a closed curly brace). i does not vary over any values here. f) for (i in (function(x) x*x) (c(1, 2, 3))) { } (2 points) The variable i takes on the values 1, 4, 9. The for loop expression defines a function that returns the square of its input, and then broadcasts that function to the vector 1, 2, 3, yielding the squares. g) for (i in NULL) { } (2 points) The variable i takes on no values. NULL is interpreted as the empty list. h) for (i in strsplit (as.character (4*atan (1)),'') [[1]] [1:10]) { }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
