This is for R
date <- seq(as.Date("2020/03/11"), as.Date("2020/03/16"), "day")
x_pos_a <- c(1, 5, 4, 9, 0)
x_pos_b <- c(2, 6, 9, 5, 4)
like so [...]
I have a timeseries dataframe with 69 time points. The rows in the dataframe are dates. Four variables (pos, anx, ang, sad) have been measured from three populations (A, B, C). Three samples were drawn from each population (x, y, z). Currently, each combination of the variable, population, and sample forms a column in the dataframe. For example, "x_pos_A", "x_pos_B", "x_pos_C", x_anx_A"..."z_sad_b", "z_sad_c".
I want to reshape it in the following shape
"Date" "variables" "population" "sample" "value"
I have spend the last 3 hours searching for answers on the forum but have been unsuccessful.
Any help much appreciated! Thanks