My MCQs are based off the Analyzing Patient Data lesson on R Programming, starting more simply with vectors and then moving to matrices.
Given the following line of code used to generate vector 'x', how would you subset the first element?
x <- c(10, 20, 30)
x(1)
x[1]
x[0]
X[1]
Given the following line of code to generate matrix 'y', how would you subset the second row?
y <- matrix(nrow=2, ncol=3, 1:6)
y[nrow=2]
y[2]
y[,2]
y[2,]
nrow
argument is used in the function for generating the matrix, not in subsetting an object