title: How to complete missing values with Na in a list?
body: <p>I have a data frame that has the following column: Tree ID, month, values. For some months, there is no recorded data, therefore those months do not exist in the data frame. I have completed the list with the missing months but now I do not know how to insert NA in the value column for the added months. </p>
  
  <p>Example: </p>
  
  <p><strong>Tree.Id</strong>: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 
  <strong>Month</strong>: Jan, Feb, Mar, May, Jun, Jul, Sept, Oct, Nov, Dec 
  <strong>Values</strong>: 1,0,1,1,0,2,1,1,0,2</p>
  
  <p>The following months are missing: Apr, Aug, 
  I added them with the code below, and now I want for those 2 added months to introduce NA in the value column. </p>
  
  <p>Here is what I tried: </p>
  
  <pre><code>tree_ls &lt;- list()
    for (i in unique(data$Tree.ID)){
  mon1 &lt;-  data$month[data$Tree.ID == i]  ###  extract the month for every Tree iD
  mon &lt;- min(mon1, na.rm=T):max(mon1, na.rm=T) # completes the numbers with the missing month 
  dat1 &lt;- data$value[data$Tree.ID == i]
  ......
  </code></pre>
  
  <p>After this step, I do not know how to create a list that will add NA for all the added months that were missing, so I will have lists of the same length.  </p>
  
  <p>Thanks </p>