title: return a plot for each level of a factor in r
body: <p>I want to produce an X,Y plot for each separate ID from the dataframe 'trajectories' :</p>
  
  <pre><code>**trajectories**
  
  X    Y    ID
  2    4     1
  1    6     1
  2    4     1
  1    8     2
  3    7     2
  1    5     2
  1    4     3
  1    6     3
  7    4     3
  </code></pre>
  
  <p>I use the code:</p>
  
  <pre><code>sapply(unique(trajectories$ID),(plot(log(abs(trajectories$X)+0.01),log((trajectories$Y)+0.01))))
  </code></pre>
  
  <p>But this does not seem to work since the error:</p>
  
  <pre><code>Error in match.fun(FUN) : 
  c("'(plot(log(abs(trajectories$X)+0.01),log((trajectories$Y)' is not a function,      character or symbol", "'    0.01)))' is not a function, character or symbol")
  </code></pre>
  
  <p>Is there a way to rewrite this code so that i get a separate plot for each ID?</p>