Module #11 Assignment
3/24/34 This week, we are tasked with debugging R code. First, I copied the bugged code into RStudio in order to see the error it returns. I also installed and loaded the "outliers" package. I also ran debug(tukey_multiple): > debug(tukey_multiple) > tukey_multiple(x) debugging in: tukey_multiple(x) debug at #1: { outliers <- array(TRUE, dim = dim(x)) for (j in 1:ncol(x)) { outliers[, j] <- outliers[, j] && tukey.outlier(x[, j]) } outlier.vec <- vector(length = nrow(x)) for (i in 1:nrow(x)) { outlier.vec[i] <- all(outliers[i, ]) } return(outlier.vec) } Browse[2]> After further investigation, I found that the && operator is used when instead, & operator should be used. && only evaluates the second expression if the first one is true.