a. Store this vector of 10 values: foo <->
i. Extract the elements greater than or equal to 5, storing the result as bar.
ii. Display the vector containing those elements from foo that remain after omitting all elements that are greater than or equal to 5.
b. Use bar from (a)(i) to construct a 2 × 3 matrix called baz, filled in a row-wise fashion. Then, do the following:
i. Replace any elements that are equal to 8 with the squared value of the element in row 1, column 2 of baz itself.
ii. Confirm that all values in baz are now less than or equal to 25 AND greater than 4.
c. Create a 3 × 2 × 3 array called qux using the following vector of 18 values: c (10,5,1,4,7,4,3,3,1,3,4,3,1,7,8,3,7,3). Then, do the following:
i. Identify the dimension-specific index positions of elements that are either 3 OR 4.
ii. Replace all elements in qux that are less than 3 OR greater than or equal to 7 with the value 100.
d. Return to foo from (a). Use the vector c(F,T) to extract every second value from foo. In Section 4.1.4, you saw that in some situations, you can substitute 0 and 1 for TRUE and FALSE. Can you perform the same extraction from foo using the vector c(0,1)? Why or why not? What does R return in this case?
->