I have two data frames
dataframe 1:
day <- c(0,3,6)
score <- c(5,11,17)
studentName <- c("Matt","Sam","Jeff")
state <- c("MA","MD","MO")
city <- c("Worcester","Silver Spring","Creve Couer")
zipCode <- c(41441,20865,61341)
dataFrame1 <- data.frame(day,score,studentName,state,city,zipCode)
dataframe 2:
day <- c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6)
score <- c(5,6,7,8,9,10,11,12,13,14,15,16,17)
studentName <- c(rep("Matt", 6),rep("Sam", 6),"Jeff")
dataFrame2 <- data.frame(day,score,studentName)
dataframe 3:
dataFrame3 <- merge(dataFrame1,dataFrame2, all = TRUE, by = c("studentName","day","score"))
Dataframe 3 has NA's and I would like to achieve output of dataframe4 programattically. Sample output of dataframe4 below:
day <- c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6)
score <- c(5,6,7,8,9,10,11,12,13,14,15,16,17)
studentName <- c(rep("Matt", 6),rep("Sam", 6),"Jeff")
state <- c(rep("MA", 6),rep("MD", 6),"MO")
city <- c(rep("Worcester", 6),rep("Silver Spring", 6),"Creve Couer")
zipCode <- c(rep(41441, 6),rep(20865, 6),61341)
dataFrame4 <- data.frame(day,score,studentName,state,city,zipCode)