I have stored two vectors as
hrs <- sample(0:23,500,replace=T)
mins<- sample(0:59,500,replace=T)
so my question is can we store these two vectors in HH:MM
format in single vector in R language?
I have stored two vectors as
hrs <- sample(0:23,500,replace=T)
mins<- sample(0:59,500,replace=T)
so my question is can we store these two vectors in HH:MM
format in single vector in R language?
We can use paste
paste(hrs, mins, sep=":")
If we need the HH:MM
format, use sprintf
sprintf("%02d:%02d", hrs, mins)