Hello all,
I am trying to combine rows based on certain columns while concatenating cells from other columns
My original data frame looks like this:
ID <- c(rep('1',2),rep('2',2))
Time <- c(rep('11/17/19',2), rep('11/18/19',2))
User <- c(rep('sys',2), rep('man',2))
Name <- c('start','finish','start','finish')
oldval <- c('11/18/19','11/19/19','11/20/19','11/21/19')
newval <- c('11/22/19','11/23/19','11/24/19','11/25/19')
d <- data.frame(ID,Time,User,Name, oldval, newval)
d
I want to combine the values in oldval and new val in one cell based on ID,Time, User, Name
So my end results should look like this:
ID_1 <- c(1,2)
Time_1 <- c('11/17/19','11/18/19')
User_1 <- c('sys','man')
Name_1 <- c('start, finish','start, finish')
oldval_1 <- c('11-18-19, 11/19/19','11/20/19, 11/21/19')
newval_1 <- c('11-22-19, 11/23/19','11/24/19, 11/25/19')
d_1 <- data.frame(ID_1, Time_1, User_1, Name_1, oldval_1, newval_1)
d
d_1