DESCRIPTION Students: Please keep in mind the OMSI rules. Save your files often, make sure OMSI fills your entire screen at all times, etc. Remember that clicking CopyQtoA will copy the entire question box to the answer box. In questions involving code which will PARTIALLY be given to you in the question specs, you may need add new lines. There may not be information given as to where the lines should be inserted. MAKE SURE TO RUN THE CODE IN PROBLEMS THAT INVOLVE CODE! QUESTION -ext .R -run 'Rscript omsi_answer1.R' (Code answer.) If a matrix m is very large, print(m) will not display well. So we might want to print only the "northwest corner," say the top 5 rows and leftmost 5 columns. Write code so that print(mt) will do this, for any matrix mt. Of course, if there are fewer than 5 rows or columns, they will all be printed out. <- function(mt) { } > m1 <- matrix(1:36,ncol=6) > print(m1) [1] "top 5 rows/cols" [1] 1 7 13 19 25 [1] 2 8 14 20 26 [1] 3 9 15 21 27 [1] 4 10 16 22 28 [1] 5 11 17 23 29 > m2 <- matrix(1:12,nrow=2) > print(m2) [1] "top 5 rows/cols" [1] 1 3 5 7 9 [1] 2 4 6 8 10 QUESTION -ext .R -run 'Rscript omsi_answer2.R' (Code answer.) The third argument in apply() must be a function of one argument. If that function has more than one, we must make a new function to feed into apply(). Write a function that returns a vector consisting of the k-th smallest element in each row of a matrix. Your code must include a call to apply(), and for full credit, also must use a closure. ksmalls <- function(mt,k) { } m2 <- matrix(1:12,nrow=2) printksmalls(m2,3) # prints 5, 6