# Quiz answers # rows 1:10 of the first two columns 1:10 1:2 sup3[c(1,2,3,4,5,6,7,8,9,10), c(1,2)] sup3[1:10, 1:2] # rows 1:10 of the first two columns in reverse order 10:1 sup3[10:1, 1:2] # rows 1:10 of the first two columns in reverse order, # but not the third row of the result sup3[10:1, 1:2] (sup3[10:1, 1:2])[-3, ] # rows 1:10 of the first two columns in random order # hint: use sample() sample(1:10) sup3[sample(1:10), 1:2] # rows 1:10 of the first two columns, ordered by # the value in the second column, ascending # hint: use order() sup3[1:10,2] order(sup3[1:10,2]) sup3[order(sup3[1:10,2]), 1:2] # rows 1:10 of the column named Mo.LPS sup3[1:10, "Mo.LPS"] sup3$Mo.LPS[1:10] # rows 1:10 of the columns named Mo.LPS and Mo.ctrl sup3[1:10, c("Mo.LPS", "Mo.ctrl")] # all genes with gene-names that are three characters long sup3$genes nchar(sup3$genes) nchar(sup3$genes) == 3 sup3$genes[nchar(sup3$genes) == 3] # column 1:2 of all rows with gene-names that contain # the string "Il" grep("Il", "IlInThisString") grep("Il", "NoneInThisString") # not grep("Il", sup3$genes) sup3[grep("Il", sup3$genes), 1:2] # all genes for which B-cells are stimulated by LPS by # more than 2 log units. sup3$B.ctrl - sup3$B.LPS (sup3$B.ctrl - sup3$B.LPS) < -2 sup3[(sup3$B.ctrl - sup3$B.LPS) < -2, 1:3] [END]