title: Count missing values with rowwise and add number of missing values
body: <p>Hi there: I would like to add a column to a dataframe that looks like this that has the number of missing values in it.</p>
  <pre><code>var1&lt;-rnorm(100)
  var2&lt;-rnorm(100)
  df&lt;-data.frame(var1, var2)
  #Set 1 missing value
  df[1,1]&lt;-NA
  df[2,1]&lt;-NA
  
  library(tidyverse)
  df
  df %&gt;% 
  #I know select is somewhat superflurous in this dataframe, but I need it in my example, so I want to be sure I get ti right
    select(var1, var2) %&gt;% 
    is.na() %&gt;% 
  #The missing values are there. 
    head()
  #How do I add the counts
  df %&gt;% 
    select(var1, var2) %&gt;% 
    rowwise() %&gt;% 
    mutate(na=rowSums(is.na(.)))
  
  </code></pre>