-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
  • 355,584
  • 18
  • 123
  • 178
Girish Khole
  • 71
  • 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
  • 789,025
  • 32
  • 460
  • 575