Hi, I would like to go from wide format in the picture where I have 8 columns, to a long format where I end up with three columns (one with prices, one with quantities, and one column with an ID number, and one column with years i guess). p0, p1 etc represents individual products, so I need some sort of an ID number to distinguish the different products.

Do anyone have any suggestions on how to do this?

Here is the data:

p0 <- c(2.97, 2.96, 2.93, 3.03)

p1 <- c(3.64, 3.50, 3.36, 3.42)

p2 <- c(6.75, 6.71, 6.67, 6.73)

p3 <- c(3.37, 3.29, 3.37, 3.37)

q0 <- c(15, 25, 32, 33)

q1 <- c(44, 79, 65, 90)

q2 <- c(49, 41, 35, 53)

q3 <- c(35, 59, 30, 31)