Mod 11 debugging

 Debugging this R program. Steps taken. running the program. The R programming environment output an Error message. The error as seen below. 

Reformating the program using an editor that can really help readability and run time.

To correct the error. reformatting of key words, Correct spacing and alignment of iterations statements, for loops, and output: return helped the program to compile smoothly without error




> 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(length=nrow(x))
+     for (i in 1:nrow(x))
+     { outlier.vec[i] <- all(outliers[i,]) } return(outlier.vec) }
Error: unexpected symbol in:
"    for (i in 1:nrow(x))
    { outlier.vec[i] <- all(outliers[i,]) } return"




> tukey_multiple <- function(x) {
+     
+ 
> 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(length=nrow(x))
+     for (i in 1:nrow(x))
+     { outlier.vec[i] <- all(outliers[i,])
+     }
+     
+     
+     return(outlier.vec)
+     
+ }




Comments

Popular posts from this blog

R secure coding

Final Project-R Package