title: Transform multiple columns of the same name and different suffixes into a panel structure
body: <p>I need to put multiple variables of the same name but with different suffixes in a panel structure. For example, transforming:</p>
  <p><a href="https://i.stack.imgur.com/Htofk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Htofk.png" alt="enter image description here" /></a></p>
  <p>In this structure:</p>
  <p><a href="https://i.stack.imgur.com/eaBiE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eaBiE.png" alt="enter image description here" /></a></p>
  <p>I tried to combine the pivot_longer and pivot_wider functions from the tidyverse package, but I was not successful, as the variables are distributed between numerics, integers, characters, etc.</p>
  <p>I appreciate any help.</p>
  <p>Here's the reproducible example:</p>
  <pre><code>structure(list(class.x = c(4, 4, 4, 4, 4), class.y = c(&quot;a&quot;, &quot;a&quot;,
  &quot;a&quot;, &quot;a&quot;, &quot;a&quot;), class.x.x = structure(c(9.88131291682493e-324,
  9.88131291682493e-324, 9.88131291682493e-324, 9.88131291682493e-324,
  9.88131291682493e-324), class = &quot;integer64&quot;), var1.x = c(1, 1,
  1, 1, 1), var1.y = c(0, 0, 0, 0, 0), var1.x.x = c(&quot;b&quot;, &quot;b&quot;, &quot;b&quot;,
  &quot;b&quot;, &quot;b&quot;), var2.x = c(9, 9, 9, 9, 9), var2.y = c(5, 5, 5, 5,
  5), var2.x.x = c(&quot;c&quot;, &quot;c&quot;, &quot;c&quot;, &quot;c&quot;, &quot;c&quot;)), class = &quot;data.frame&quot;, row.names = c(NA,
  -5L))
  </code></pre>