title: Arrange columns on top of each other with tidyr
body: <p>I have a data frame that essentially consists of several (repeating) blocks (measuring stations) and thus contains several identical variables per line:</p>
  <pre><code># ┌───┬───┬───┐ ┌───┬───┬───┐   ┌───┬───┬───┐
  # │ A │ B │ C │ │ D │ E │ F │ … │ X │ Y │ Z │
  # └───┴───┴───┘ └───┴───┴───┘   └───┴───┴───┘
  </code></pre>
  <p>Is there a simple/elegant way to bring these columns on top of each other with tidyverse? By the way, the columns of each block consist of the same data type (i.e. <code>A = D = … = X</code>).</p>
  <pre><code># ┌───┬───┬───┐
  # │ A │ B │ C │
  # ├───┼───┼───┤
  # │ D │ E │ F │
  # ├───┼───┼───┤
  # │ … │ … │ … │
  # ├───┼───┼───┤
  # │ X │ Y │ Z │
  # └───┴───┴───┘
  </code></pre>
  <p>My attempt to do this with <a href="https://tidyr.tidyverse.org/reference/pivot_longer.html" rel="nofollow noreferrer"><code>pivot_longer()</code></a> has been unsuccessful so far, unfortunately, because it takes the other columns into account and I get some kind of cross set as a result, which makes my initial situation much worse.</p>
  <p>Below is an exemplary data frame for the problem above:</p>
  <pre class="lang-r prettyprint-override"><code>data &lt;- data.frame(
    # First block
    a = c(1, 1, 1, 1, 1),
    b = c(2, 2, 2, 2, 2),
    c = c(3, 3, 3, 3, 3),
    # Second block
    d = c(4, 4, 4, 4, 4),
    e = c(5, 5, 5, 5, 5),
    f = c(6, 6, 6, 6, 6),
    # Third block
    x = c(7, 7, 7, 7, 7),
    y = c(8, 8, 8, 8, 8),
    z = c(9, 9, 9, 9, 9)
  )
  </code></pre>
  <p>The desired result should look like the following data frame:</p>
  <pre class="lang-r prettyprint-override"><code>data_final &lt;- data.frame(
    a = c(1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 7, 7, 7, 7, 7),
    b = c(2, 2, 2, 2, 2, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8),
    c = c(3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 9, 9, 9, 9, 9)
  )
  </code></pre>
  <p>Thanks in advance!</p>