title: R: iterating through unique values of a vector in for loop
body: <p>I'm new to R and I am having some trouble iterating through the unique element of a vector. I have a dataframe "School" with 700 different teachers. Each teacher has around 40 students. </p>
  
  <p>I want to be able to loop through each teacher, create a graphs for the mean score of his/her students' over time, save the graphs in a folder and automatically email that folder to that teacher.</p>
  
  <p>I'm just getting started and am having trouble setting up the for-loop. In Stata, I know how to loop through each unique element in a list, but am having trouble doing that in R. Any help would be appreciated.</p>
  
  <pre><code>School$Teacher     School$Student    School$ScoreNovember    School$ScoreDec    School$TeacherEmail  
       A                1                35                     45                A@school.org  
       A                2                43                     65                A@school.org    
       B                1                66                     54                B@school.org  
       A                3                97                     99                A@school.org  
       C                1                23                     45                C@school.org  
  </code></pre>