title: Mean of a row with binary outcome?
body: <p>I have a dataset containing a variable that was measured on a Likert scale. To produce some descriptives I want to calculate the mean of a row for 2 possible outcomes. The outcomes are 0(not donated) 1 (donated). The variable is called donated. The variable that I want to calculate the mean from per outcome is called AWB01W14.</p>
  <p>My code is:</p>
  <pre><code># Specify data frame
  survey %&gt;%                                      
  
  # Specify group indicator, column, function
  group_by(survey$donated) %&gt;%                        
  summarise_at(vars(AWB01W14, na.rm = TRUE, dims = 1),
          list(name = mean))
  </code></pre>
  <p>I receive the following error:</p>
  <pre><code>Error: Must subset columns with a valid subscript vector. x Subscript has the wrong type `logical`. ℹ It must be numeric or character. Run `rlang::last_error()` to see where the error occurred.
  </code></pre>
  <p>I have tried to convert the variables to numeric. It gave me this code.</p>
  <pre><code>survey$donated = as.numeric(survey$donated)
  survey$AWB01W14 = as.numeric(survey$AWB01W14)
  
  
  
  # Specify data frame
  survey %&gt;%                                      
  
  # Specify group indicator, column, function
  group_by(survey$donated) %&gt;%                        
  summarise_at(vars(AWB01W14, na.rm = TRUE, dims = 1),
          list(name = mean))
  </code></pre>
  <p>Yet is still receive the same error.</p>
  <p>Can someone help me? Thanks in advance:)</p>