text: Q:
  
  Plotting seperate boxplot for each variable in R
  
  I searched a lot for how to do it and could not find anything relevant. 
  I am trying to plot a separate boxplot for each variable in my dataset inside a for-loop. I tried the following:
  for (column in names(articles)){
    if(is.numeric(articles[, column])) {
      bwplot(~column ,data = articles,main= paste(column))
    }
  }
  
  However, it is not producing what I want. How can I approach this
  
  A:
  
  We can get all the numeric columns of the dataframe, use lapply to loop over each and create a list of plots. 
  cols <- names(iris)[sapply(iris, is.numeric)]
  
  list_diag <- lapply(cols, function(x) 
                      bwplot(reformulate(x), data = iris, main = x))
  list_diag[[1]]
  
  To do this in a for loop we can do :
  list_diag <- vector("list", length(cols))
  for (i in seq_along(cols)) {
    list_diag[[i]] <- bwplot(reformulate(cols[i]), data = iris, main = cols[i])
   }
  
  