How can I combine two dataframes with different lengths in R?
<p>I have two dataframes, like those:</p>

<p><a href="https://i.stack.imgur.com/FwONU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FwONU.png" alt="Year 1"></a></p>

<p>and </p>

<p><a href="https://i.stack.imgur.com/dJxdK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dJxdK.png" alt="enter image description here"></a></p>

<p>I want to get something like that: </p>

<p><a href="https://i.stack.imgur.com/hGGSC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hGGSC.png" alt="enter image description here"></a></p>

<p>Here are the data frames for reproducibility:</p>

<pre><code>df1 &lt;- data.frame(descripcion_cuenta_N2 = c("Consumos", "Costes Personal", "Fungible Equipamiento", "Servicios"), anualidad = rep(2014, 4), valor = c(10, 11, 12, 13))
df2 &lt;- data.frame(descripcion_cuenta_N2 = c("Consumos", "Costes Personal", "Fungible Equipamiento","Prestaciones", "Servicios"), anualidad = rep(2014, 5), valor = c(11, 20, 8, 9))
</code></pre>

<p>A dataframe in which missed positions are filled with 0, because in some cases I am not getting data frames with the same amount of rows, and in those cases rbind fails, and I get an error.</p>

<p>Which instruccion should use to combine those dataframes?</p>

<p>Thanks</p>

<p>PS: I know I can erase the repeated rows once the data frames are together.</p>