I've got a dataset like this:
dat1 <- read.table(header=TRUE, text="
ID A_1 B_1 C_1 A_2 B_2 C_2
1 1 2 1 5 5 5
2 1 3 3 4 4 1
3 1 3 1 3 2 2
4 2 5 5 3 2 2
5 1 4 1 2 1 3
")
I would like to convert this to a long format, with one column for the ID, one for the system (1 or 2), one for the variable (A, B, or C) and one with the value. I can't figure out how to do that, I would be very grateful if somebody could help me out.
I already tried the pivot_longer command, but it only gives me three columns one for the ID one for the variables and one for the value.
Thanks!!