merge (opposite of split) pair of rows in r
问题 I have the column like the following. Each column has two pairs each with suffix "a" and "b" - for example col1a, col1b, colNa, colNb and so on till end of the file (> 50000). mydataf <- data.frame (Ind = 1:5, col1a = sample (c(1:3), 5, replace = T), col1b = sample (c(1:3), 5, replace = T), colNa = sample (c(1:3), 5, replace = T), colNb = sample (c(1:3),5, replace = T), K_a = sample (c("A", "B"),5, replace = T), K_b = sample (c("A", "B"),5, replace = T)) mydataf Ind col1a col1b colNa colNb K