title: Using for loop to create multiple ggplots
body: <pre><code>p[[2]]&lt;-ggplot(data = icadata, aes(x = icadata[[2]])) + geom_histogram()    
  p[[3]]&lt;-ggplot(data = icadata, aes(x = icadata[[3]])) + geom_histogram()    
  p[[4]]&lt;-ggplot(data = icadata, aes(x = icadata[[4]])) + geom_histogram()    
  p[[5]]&lt;-ggplot(data = icadata, aes(x = icadata[[5]])) + geom_histogram()    
  p[[6]]&lt;-ggplot(data = icadata, aes(x = icadata[[6]])) + geom_histogram()    
  p[[7]]&lt;-ggplot(data = icadata, aes(x = icadata[[7]])) + geom_histogram()    
  p[[8]]&lt;-ggplot(data = icadata, aes(x = icadata[[8]])) + geom_histogram()    
  p[[9]]&lt;-ggplot(data = icadata, aes(x = icadata[[9]])) + geom_histogram()    
  p[[10]]&lt;-ggplot(data = icadata, aes(x = icadata[[10]])) + geom_histogram()    
  p[[11]]&lt;-ggplot(data = icadata, aes(x = icadata[[11]])) + geom_histogram()    
  p[[12]]&lt;-ggplot(data = icadata, aes(x = icadata[[12]])) + geom_histogram()    
  p[[13]]&lt;-ggplot(data = icadata, aes(x = icadata[[13]])) + geom_histogram()    
  p[[16]]&lt;-ggplot(data = icadata, aes(x = icadata[[16]])) + geom_histogram()    
  
  p &lt;- list()    
  for(i in c(2:13,16) ) {      
             p[[i]]&lt;-ggplot(data = icadata, aes(x = icadata[[i]])) + geom_histogram()    
  }     
  </code></pre>
  
  <p>What's the difference between the codes above?<br>
  Why do I get always the same picture after runnning the for loop code?</p>