title: R: Using Summarize() accross() and where() with regular expressions
body: <p>I have the following dataset:</p>
  <pre><code>Lines &lt;- &quot;id time sex Age Obs_A Obs_B Obs_C
  1  1       male   90 0 0 0
  1  2       male   91 0 0 0
  1  3       male   92 1 1 0
  2  1       female  87 0 1 1
  2  2       female  88 0 1 0
  2  3       female  89 0 0 1
  3  1       male  50 0 1 0
  3  2       male  51 1 0 0
  3  3       male  52 0 0 0
  4  1       female  54 0 1 0
  4  2       female  55 0 1 0
  4  3       female  56 0 1 0&quot;
  </code></pre>
  <p>I want to combine <code>summarize</code> with regular expressions (<code>grepl</code>) in order to reformat the variables that start with <code>Obs</code> (e.g. take the median) while do other operations for other variables. For example something like this:</p>
  <pre><code>TTE &lt;- TTE %&gt;%
        group_by(id, across(where(is.character))) %&gt;%
        summarise(id = first(id), sex = first(sex), 
                  Age = mean(Age), across(where(grepl(&quot;Obs&quot;)), mean), across(where(is.numeric), max)) %&gt;%
        ungroup 
  </code></pre>
  <p>Nonetheless, I get the following error:</p>
  <pre><code>x argument &quot;x&quot; is missing, with no default
  </code></pre>
  <p>Any idea on how to use <code>summarize()</code>, <code>across()</code>, <code>where()</code> and <code>grepl()</code> in a consistent way?</p>