Let's say I have two matrices: A and B:
mth <- c(rep(1:5,2)) day <- c(rep(10,5),rep(11,5)) hr <- c(3,4,5,6,7,3,4,5,6,7) v <- c(3,4,5,4,3,3,4,5,4,3) A <- data.frame(cbind(mth,day,hr,v)) year <- c(2008:2012) mth <- c(1:5) B <- data.frame(cbind(year,mth))
I want to look like this:
mth <- c(rep(2008:2012,2)) day <- c(rep(10,5),rep(11,5)) hr <- c(3,4,5,6,7,3,4,5,6,7) v <- c(3,4,5,4,3,3,4,5,4,3) A <- data.frame(cbind(mth,day,hr,v))
Basically I need to change the mth column from with the year of the column to B, Maybe I was not looking for a suitable keyword, I could not get what I want (I tried that ()), please help, thanks.