1. dimension 2. maxQ <- function() { turk <- read.csv('turkiye-student-evaluation_R_Specific.csv') turk <- turk[,-(1:5)] tpca <- prcomp(turk) rot <- tpca$rotation which.max(abs(rot[,3])) } print(maxQ()) # 1 3. wt38 <- function() { turk <- read.csv('turkiye-student-evaluation_R_Specific.csv') turk <- turk[,-(1:5)] tpca <- prcomp(turk) rot <- tpca$rotation rot[8,3] } print(wt38()) # 0.1642224 4. oneRow <- function(w,h,i) w[i,] %*% h a <- rbind(1:3,c(5,1,8)) b <- rbind(c(1,2,10),c(4,12,0),c(0,0,1)) print(oneRow(a,b,2)) # prints (9,22,58)