## 140.886 ## Module 5 Exercise - ## 1/6/2015 1) What do the following functions do? a. nrow() b. which() c. matrix() d. length() e. c() 2) What code would do the following? a. Reads in a comma separated value spreadsheet named “file.csv” b. Returns the class of an R object called ‘jump’ c. Shows the first 5 elements of the numeric vector ‘num’ d. Displays the unique elements of the integer vector ‘yr’ 3) Pretend the following is a real R function: hiphop(x, snare=TRUE, beats=TRUE, jam=FALSE) a. What is the name of this function? b. How many arguments does it take? c. How many arguments are required? d. Which arguments have default values? What are these values? 4) For numeric R objects ‘A’ and ‘B’, where length(A) = length(B), translate the following from “logical” to “English”: a. Example: B < 2: ‘B less than 2’ b. A > 5 c. B ==5 d. A > B e. A < 6 & B ==6 f. A < 0 | B > 7 g. A < 8 & A > 0 & B > 4 h. A != B & B > 1