How to stack a dataframe in R [duplicate]
问题 This question already has answers here : Reshaping data.frame from wide to long format (9 answers) Closed 2 years ago . I have a data frame that I would like to stack in R so that I end up with three columns. Below cis some example data in its current format. > dput(df) structure(list(Day = c("d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10"), A1 = c(14L, 24L, 22L, NA, NA, NA, NA, NA, NA, NA), A2 = c(9L, 15L, 34L, 2L, 12L, 34L, 234L, 34L, NA, NA ), A3 = c(3L, 4L, 19L, 76L, 34L, 34L,