title: Recycling and assignment functions (`split<-`)
body: <p>Can someone please explain me how this one line of R code works?</p>
  
  <pre><code>split(dat, f) &lt;- lapply(split(dat, f), max)
  </code></pre>
  
  <p>I thought it is a just a recycling rule but really I can't understand it.</p>
  
  <p>Data example : </p>
  
  <pre><code>dat &lt;- c(1, 2, 3, 100, 200, 300)
  f &lt;- as.factor(c("a", "a", "b", "a", "b", "b"))
  split(dat, f) &lt;- lapply(split(dat, f), max)
  dat
  [1] 100 100 300 100 300 300
  </code></pre>
  
  <p>The code do what I want to do (assign the max by group) but the question is how this is done?</p>