Reputation: 65
Hello, I am trying to merge these two data frames such that there's only one unique time column and an additional column called TYPE is created which is attributed to PK (TYPE==1) or PD (TYPE==2) for their respective times. I have never done something like this before, any help would be highly appreciated.
temptime<-c(0,1,2,3,4,5,6)
tempconc<-c(0:6)
PK<-cbind(temptime,tempconc)
temppdtime<-c(0,2,5,7,9)
temppd<-c(100:104)
PD<-cbind(temppdtime,temppd)
PKPD<-merge(PK,PD)
PKPD
Thank you.
Upvotes: 0
Views: 51
Reputation: 325
Rename your time variables to be the same in both PK and PD. Then create the TYPE variable in each PK and PD, filled out with 1 or 2 for the respective dataframe. Then rbind PK and PD.
Upvotes: 1