title: R: using ddply to apply functions to subsets of data
body: <p>I'm trying to use the ddply method to take a dataframe with various info about 3000 movies and then calculate the mean gross of each genre. I'm new to R, and I've read all the questions on here relating to ddply, but I still can't seem to get it right. Here's what I have now:</p>
  
  <pre><code>&gt; attach(movies)
  &gt; ddply(movies, Genre, mean(Gross))
  Error in llply(.data = .data, .fun = .fun, ..., .progress = .progress,  : 
  .fun is not a function.
  </code></pre>
  
  <p>How am I supposed to write a function that takes the mean of the values in the "Gross" column for each set of movies, grouped by genre? I know this seems like a simple question, but the documentation is really confusing to me, and I'm not too familiar with R syntax yet.</p>
  
  <p>Is there a method other than ddply that would make this easier?</p>
  
  <p>Thanks!!</p>