title: Boxplot with a for loop
body: <p>I have a list of data frames called: mylist. Headers of the list are names of people and the data frames contain columns with data associated with those names (date, height, weight, etc) </p>
  
  <pre><code>names(mylist[1])
  [1] "John"
  names(mylist[2])
  [1] "Susan"
  
  
  mylist[[1]]
  [1] name  date hight weight ....
      John  1950 1.81  78
      John  1948 1.60  60
      John  1935 1.50  55
  
  mylist[[2]]
  [1] name  date hight weight ....
      Susan 1985 1.40  40    .
      Susan 1995 1.45  60
      Susan 1990 1.25  40
  </code></pre>
  
  <p>I want to create a boxplot for each of the metrics: one boxplot for height, one for weight, etc. And I want to include just in each metric's boxplot all people information. For example, I want a box plot for height that contains the info of John, Susan, etc.</p>
  
  <p>Here is my attempt for the loop but it is not working. </p>
  
  <pre><code>for(s in 3:21) {
  boxplot(x=for(i in 1:99){ mylist[[i]][s]}))
  }
  </code></pre>
  
  <hr>
  
  <p>Hi guys, I applied nograpes solution. Although, the code that he suggested:</p>
  
  <pre><code>ggplot(melted.df,aes(x=name,y=value)) + 
  geom_boxplot() + facet_grid(variable~.,scales='free')
  </code></pre>
  
  <p>stacks each boxplot above each other and finally the plot is unreadable as there are 16 boxplots. Thus, a good idea is to create 16 different boxplots, one for each metric.</p>
  
  <p>I've been looking for solutions for this and one is to run this code:</p>
  
  <pre><code>tomelt&lt;-data.frame(c(daily[1],daily[2],daily[3])) #create a data.frame with variable   name, date and the variable to be ploted. 
  
  melted.df&lt;-melt(tomelt,id.vars=c('name', 'date')) #convert to long form 
  ggplot(melted.df,aes(x=name,y=value)) + geom_boxplot() #plot 
  </code></pre>
  
  <p>16 times, each time changing the code to call another metric(column) of the data frame... but obviously that this is not efficient at all.</p>
  
  <p>Do you have any idea on how to create a for loop to do this? </p>