title: Spark - subset dataset based on occurences of user id
body: <p>I would like to filter a dataset to only keep the rows of users which occur at least X times in the dataset. In the example below I would only like to keep the rows with "id1" and "id2". How can I achieve this?</p>
  
  <pre><code>  case class UserValue(UserId: String, value: Double)
  
    val values = sc.parallelize(Seq(UserValue("id1", 5.0),
          Rating("id2", 4.0),
          Rating("id2", 3.0),
          Rating("id1", 2.0),
          Rating("id3", 1.0)))
  </code></pre>