title: R - Reshape data set to include values for all conditions, even if they are zero
body: <p>I have this short data frame:</p>
  
  <pre><code>population.served &lt;- c(200:210)
  area &lt;- c("Cambridge", "Oxford","Cambridge", "Oxford", "Cambridge", "Oxford","London","Cambridge", "Oxford", "London","Edinburgh")
  year &lt;- c("Year.1", "Year.1","Year.2", "Year.2","Year.3", "Year.3","Year.3", "Year.4", "Year.4","Year.4","Year.4" )
  data &lt;- data.frame(population.served, area, year) 
  </code></pre>
  
  <p>How do I make it so that all area and year entries include  a value for the population.served, even if they are zero values?</p>
  
  <p>I want the data to look like this:</p>
  
  <pre><code>population.served &lt;- c(200, 201, 0, 0, 202, 203, 0, 0, 204, 205, 206, 0, 207, 208, 209, 210)
  area &lt;- c("Cambridge", "Oxford","London","Edinburgh", "Cambridge", "Oxford","London","Edinburgh","Cambridge", "Oxford","London","Edinburgh","Cambridge", "Oxford","London","Edinburgh")
  year &lt;- c("Year.1", "Year.1","Year.1", "Year.1","Year.2", "Year.2","Year.2", "Year.2","Year.3", "Year.3","Year.3", "Year.3","Year.4", "Year.4","Year.4","Year.4" )
  data2 &lt;- data.frame(population.served, area, year) 
  </code></pre>