dimanche 27 juin 2021

Where do I mess up with boxplot in a for function?

I am fairly new to R (I am student) and I need to make an algorithm that returns the lowest outlier for each numeric (or integer) variable. If the variable does not have an outlier, it should return the string “Nooutliers”. If the variable is not numeric, it needs to print the most common value. I started it this way:

for (n in seq_along(london)) { 
  if  (class(london[[n]]) == "numeric") { 
    out <- boxplot.stats(london[[n]])$out

but this way it messes up when I try to paste the informations at the end. I did not find any other good way for this ( to find it for columns, select the minimum value and so on.) Is there some other way I should do it or did I just mess it upp?

Aucun commentaire:

Enregistrer un commentaire