Min and Median of Multiple Columns of a DF by Row in R
<p>Given a <code>dataframe</code> that looks like:</p>

<pre><code>V1  V2  V3
5   8   12
4   9   5
7   3   9
...
</code></pre>

<p>How to add columns to the <code>dataframe</code> for min and median of these 3 columns, calculated for each row?</p>

<p>The resulting DF should look like:</p>

<pre><code>V1  V2  V3  Min  Median
5   8   12  5    8
4   9   5   4    5
7   3   9   3    7
...
</code></pre>

<p>I tried using <code>dplyr::mutate</code>:</p>

<pre><code>mutate(df, Min = min(V1,V2,V3)) 
</code></pre>

<p>but that takes the min of the entire dataframe and puts that value in every row. How can I get the min and median of just each row?</p>

<p>For Mean, I can use <code>rowMeans</code> in <code>mutate</code>, but there are no similar functions for min and median.</p>

<p>Also tried,</p>

<pre><code>lapply(df[1:3], median)
</code></pre>

<p>but it just produces the median of each column</p>

<pre><code>dd &lt;- read.table(header = TRUE, text = 'V1  V2  V3
5   8   12
4   9   5
7   3   9')
</code></pre>