title: Selecting N rows in R using Sparklyr
body: <p>I'm trying to select distinct middle rows of SparkDataframe using Sparklyr.</p>
  
  <p>I've been looking for it and I have not found it (only <em>head</em> and <em>tail</em> functions but I don't want these). Is there a sparklyr function that makes the same as traditional R playing with dimensions of dataframe?
  I need to create a R dataframe with n:m rows of a SparkDataframe.</p>
  
  <p>For example, if n=1 and m=5:</p>
  
  <p><strong>Traditional R</strong></p>
  
  <pre><code>data(iris)
  
  iris2 &lt;- iris[1 : 5, ]
  </code></pre>
  
  <p><strong>Sparklyr</strong></p>
  
  <pre><code>sc &lt;- spark_connect(master = "local")
  iris_tbl &lt;- sdf_copy_to(sc, iris, name = "iris", overwrite = TRUE)
  </code></pre>
  
  <p>Tips: I was reviewing <em>slice()</em> but an errors ocurrs when I code:</p>
  
  <pre><code>iris2 &lt;- iris_tbl %&gt;% slice(1:5) %&gt;% collect()
  
  no applicable method for 'slice' applied to an object of class "c('tbl_spark', 'tbl_sql', 'tbl_lazy', 'tbl')"
  </code></pre>
  
  <p>Thank you!</p>