Posts

Showing posts from April, 2026

Assignment #12: Introduction to R Markdown

Image
 R markdown is a fairly interesting idea in concept. The whole Latex system took a bit of research to figure out, and I only used a very small portion of what its capable of. You can easily setup the narrative and code sections of an R markdown document to prepare an easy to follow presentation.  As shown you can add code and run it similar to how the output to html is. The code and immediate output is woven into the document.  code repository can be found at: https://github.com/Wrightkov/r-programming-assignments

Assignment 11

 Today's lesson is in debugging. we were given the code: tukey.outlier <- function(x, k = 1.5) {   q1 <- quantile(x, 0.25, na.rm = TRUE)   q3 <- quantile(x, 0.75, na.rm = TRUE)   iqr <- q3 - q1   x < (q1 - k * iqr) | x > (q3 + k * iqr) } tukey_multiple <- function(x) {   outliers <- array(TRUE, dim = dim(x))   for (j in 1:ncol(x)) {     outliers[, j] <- outliers[, j] && tukey.outlier(x[, j])   }   outlier.vec <- vector("logical", length = nrow(x))   for (i in 1:nrow(x)) {     outlier.vec[i] <- all(outliers[i, ])   }   return(outlier.vec) Error in outliers[, j] && tukey.outlier(x[, j]) : 'length = 10' in coercion to 'logical(1) when run with a seed it gives this error, this happens because this only evaluates the first element in each vector. A fully corrected and debugged version of the code can be found here. This replaces the broken && code and t...