-3

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?

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
Girish Khole
  • 71
  • 1
  • 2
  • 13

1 Answers1

1

We can use paste

paste(hrs, mins, sep=":")

If we need the HH:MM format, use sprintf

sprintf("%02d:%02d", hrs, mins)
akrun
  • 874,273
  • 37
  • 540
  • 662