How do I replicate one value based on a previous value?
e.g
My dataset
name <- c("sergio",NA,NA,NA,NA,"John", NA,NA,NA,NA,NA,NA) number <-c(1234,NA,NA,NA,NA,5678, NA,NA,NA,NA,NA,NA) mydata <- cbind(as.data.frame(name),as.data.frame(number)) New dataset
name number sergio 1234 sergio 1234 sergio 1234 sergio 1234 John 5678 John 5678 John 5678 John 5678 John 5678 John 5678 .... etc