Home > database >  qqplot and qqline in loop
qqplot and qqline in loop

Time:02-14

i am trying to make a loop for each columns in the database. i am getting this Error: Must use a vector in [, not an object of class matrix. my data looks like this: database str and this is my code:

for (q in 1:ncol(flat_file_numeric[])) {   
    qqnorm(flat_file_numeric[,q])
    qqline(flat_file_numeric[,q], col= "steelblue",lwd=2)}

i will appreciate any help. thanks.

CodePudding user response:

Without some actual data is it hard to be sure, but from the error message it looks like some problem with the data itself.

I would start by trying this prior to the loop:

flat_file_numeric <- as.data.frame(flat_file_numeric)
  • Related