title: Find the earliest and latest date within each row in R
body: <p>I have large data set with over 400 columns which represent certain user input elements from an online platform and the time when each input occured. Each row represent a user ID.</p>
  <p>200 of those columns are of class &quot;POSIXct&quot; &quot;POSIXt&quot; (e.g. 2019-11-04 15:33:50), and missing values can occure, as not every element is displayed to or filled in by every user.</p>
  <p>My goal is to create two additional columns that include the earliest and the latest date per row of each of those 200 &quot;POSIXct&quot; &quot;POSIXt&quot; columns.</p>
  <p>Here a simplified example of the frame and one of the desired additional columns.
  (ID 4 would be someone that never bothered to open the side, but has data from other data sources available, and should remain in the dataset for now)</p>
  <pre><code>ID Other_columns    date_column          date_column2          date_column3             max_date (what I want)
  1  &quot;numeric&quot;        2019-11-04 19:33:50  2019-11-05 15:33:50   2019-11-05 16:33:50      2019-11-05 16:33:50
  2  &quot;numeric&quot;        NA                   2019-11-04 17:20:10   2019-11-09 19:12:50      2019-11-09 19:12:50
  3  &quot;numeric&quot;        2019-11-07 20:33:50  NA                    2019-11-04 18:31:50      2019-11-07 20:33:50
  4  NA               NA                   NA                    NA                       NA
  </code></pre>
  <p>So far I did not really come further that filtering out the other non-date columns,</p>
  <pre><code>is.POSIXt &lt;- function(x) inherits(x, &quot;POSIXt&quot;)      
  df%&gt;%select(where(is.POSIXt))
  </code></pre>
  <p>Instead of the select I probably should use a mutate_at or something as condition,
  but what is the best way to check all of those remaining 200 date/time columns and then assign the earliest/latest date to the newly created columns (while ignoring the NA values).</p>