jeudi 17 janvier 2019

I am new to R. Why the "if" loop is not running

df <- data.frame(mpg) 
plotCols <- function(df) { 
  for (i in colnames(df)) { 
    if(is.numeric(i) == TRUE) { 
      g <- ggplot(df,aes(x = "hwy")) + 
             geom_histogram() print(g) } 
    else { print("Hi") } 
   } 
 }

Aucun commentaire:

Enregistrer un commentaire