0

I have the following table:

Attribute1 Attribute2 Attribute3 Attribute4
a valueX valueY valueZ
b value1 value9 value7
c value8 valueH valueG
d valueQ value3 value0

I need to transpose and transform this table in R like this:

Attribute1 Attributes Value
a Attribute2 valueX
a Attribute3 valueY
a Attribute4 valueZ
b Attribute2 value1
b Attribute3 value9
b Attribute4 value7
c Attribute2 value8
c Attribute3 valueH
c Attribute4 valueG

I tried so far to use the t() function, but without a good result.

I mention that I have multiple number of attributes.

Can you please give me a clue?

CrisABCD
  • 3
  • 1
  • 7
  • E.g. `tidyr::pivot_longer(df, -Attribute1, names_to = "Attribute", values_to = "Value")` – harre Sep 02 '22 at 17:56

0 Answers0