title: Assigning NULL to a list element in R?
body: <p>I found this behaviour odd and wanted more experienced users to share their thoughts and workarounds.
  On running the code sample below in R:</p>
  
  <pre><code>sampleList &lt;- list()
  d&lt;- data.frame(x1 = letters[1:10], x2 = 1:10, stringsAsFactors = FALSE)
  for(i in 1:nrow(d)) {
          sampleList[[i]] &lt;- d$x1[i]
  }
  
  print(sampleList[[1]])
  #[1] "a"
  print(sampleList[[2]])
  #[1] "b"
  print(sampleList[[3]])
  #[1] "c"
  print(length(sampleList))
  #[1] 10
  
  sampleList[[2]] &lt;- NULL
  print(length(sampleList))
  #[1] 9
  print(sampleList[[2]])
  #[1] "c"
  print(sampleList[[3]])
  #[1] "d"
  </code></pre>
  
  <p>The list elements get shifted up. 
  Maybe this is as expected, but I am trying to implement a function where I merge two elements of a list and drop one. I basically want to lose that list index or have it as NULL. </p>
  
  <p>Is there any way I can assign NULL to it and not see the above behaviour?</p>
  
  <p>Thank you for your suggestions.</p>