Data i have
id <- c(1,1,1,1,2,2,2,2,3,3,3,4,4)
time <- c(1,2,3,4,1,2,2,3,1,4,4,1,2)
dose <- c(10,20,30,40,30,20,40,10,10,30,70,20,30)
rate <- c(5,6,6,7,3,4,4,6,7,8,9,2,3)
df <- data.frame(id,time,dose,rate)
Data i want
id <- c(1,1,1,1,2,2,2,3,3,3,4,4)
time <- c(1,2,3,4,1,2,3,1,4,4,1,2)
dose <- c(10,20,30,40,30,60,10,10,30,70,20,30)
rate <- c(5,6,6,7,3,4,6,7,8,9,2,3)
df2 <- data.frame(id,time,dose,rate)
I just want add the dose row, if they have same values in id,time,rate.
Please help me to do this. Thank you