title: Recode NAs in multiple dataframe columns
body: <p>I have multiple integer columns in a data frame, all with NAs that I need to recode to 0.</p>
  
  <pre><code>df1 &lt;- as.data.frame(sapply(paste(sample(letters,50,T),sample(letters,10), sep=""), function(x) {sample(c(NA,0:5),10,T)} ))
  df2 &lt;- as.data.frame(sapply(paste(sample(letters,5,T),sample(letters,10,T), sep=""), function(x) {sample(letters[1:5],10,T)} ))
  df &lt;- cbind(df2,df1)
  </code></pre>
  
  <p>Producing an output like this... (only the first few columns of the 55 shown)</p>
  
  <p><img src="https://i.stack.imgur.com/NDUxP.png" alt="enter image description here"></p>
  
  <p>I can go about recoding the NAs to 0 manually like <code>df$col[is.na(df$col)] &lt;- 0</code> for each column, but given that there are so many columns, it would take a while to type that all out. </p>
  
  <p><strong>How can I recode all of these NAs to 0 in a line or three?</strong> </p>
  
  <p>(I realise I could melt the integer columns and then recode the one melted column, but I'd rather do this in base R)</p>