Reorganize data frame elements depending on the content of the rows in R
问题 I have this dataset: df <- structure(list(V1 = c("B1D01", "B1D01", "B1D01", "B1D01", "B1D01", "B1D01", "U0155"), V2 = c("U0155", "U0155", "U0155", "U0155", "U0155", "U0155", "U3003"), V3 = c("U3003", "U3003", "C1B00", "U3003", "U3003", "U3003", "C1B00"), V4 = c("C1B00", "C1B00", "U0073", "C1B00", "C1B00", "C1B00", "P037D"), V5 = c("P037D", "P037D", NA, "P037D", "P037D", "P037D", "P0616"), V6 = c("P0616", "P0616", NA, "P0616", "P0616", "P0616", "P0562"), V7 = c("P0562", "P0562", NA, "P0562",