title: Reading multiple headers file in R
body: <p>I am reading an Excel file with the data containing two headers:</p>
  
  <ul>
  <li>Variable name</li>
  <li>Depth of the measurement (2 m or 25 m)</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/vu9nU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vu9nU.png" alt="enter image description here"></a></p>
  
  
  
  <p>Here is a subset of the data.</p>
  
  <pre class="lang-r prettyprint-override"><code>df &lt;- structure(
    list(
      date_deployed = c(NA, "02/05/2015", "04/05/2015"),
      chl_a_ug_m_2_d_1 = c("2 m", "3.3908588202404242", "10.887607383329465"),
      x4 = c("25 m", "15.023264970645787", "7.534785609849461")
    ),
    row.names = c(
      NA,
      -3L
    ),
    class = c("tbl_df", "tbl", "data.frame")
  )
  
  df
  #&gt;   date_deployed   chl_a_ug_m_2_d_1                 x4
  #&gt; 1          &lt;NA&gt;                2 m               25 m
  #&gt; 2    02/05/2015 3.3908588202404242 15.023264970645787
  #&gt; 3    04/05/2015 10.887607383329465  7.534785609849461
  </code></pre>
  
  <p>Is there an elegant way to read such file so the data looks like it:</p>
  
  <pre class="lang-r prettyprint-override"><code>data.frame(
    date_deployed = c("02/05/2015", "02/05/2015", "04/05/2015", "04/05/2015"),
    chl_a_ug_m_2_d_1 = c(3.3908588202404242, 15.023264970645787, 10.887607383329465, 7.534785609849461),
    depth = c(2, 25, 2, 25)
  )
  #&gt;   date_deployed chl_a_ug_m_2_d_1 depth
  #&gt; 1    02/05/2015         3.390859     2
  #&gt; 2    02/05/2015        15.023265    25
  #&gt; 3    04/05/2015        10.887607     2
  #&gt; 4    04/05/2015         7.534786    25
  </code></pre>
  
  <p>I was thinking to use <code>tidyxl</code> with <code>unpivotr</code> but I can not get my head around it.</p>