0

I have the following vector of dates:

> TimeSequence
[1] "2019-12-06 02:32:30 CET" "2019-12-06 02:32:49 CET" "2019-12-06 02:33:17 CET"
[4] "2019-12-06 02:33:19 CET" "2019-12-06 02:33:27 CET"

and I would like to have a matrix whose rows are equal to it. Then I tried with

> M1=matrix(rep(TimeSequence, length(TimeSequence)),ncol=length(TimeSequence),byrow = T)

but I obtained:

> M1
           [,1]       [,2]       [,3]       [,4]       [,5]
[1,] 1575595950 1575595969 1575595997 1575595999 1575596007
[2,] 1575595950 1575595969 1575595997 1575595999 1575596007
[3,] 1575595950 1575595969 1575595997 1575595999 1575596007
[4,] 1575595950 1575595969 1575595997 1575595999 1575596007
[5,] 1575595950 1575595969 1575595997 1575595999 1575596007
Mark
  • 1,577
  • 16
  • 43
  • See: [How to avoid date formatted values getting converted to numeric when assigned to a matrix or data frame?](https://stackoverflow.com/q/41697587/10488504) – GKi Dec 02 '20 at 11:31
  • or [How to create a matrix of POSIXct](https://stackoverflow.com/q/35172317/10488504) – GKi Dec 02 '20 at 11:35
  • Does this answer your question? [How to create a matrix of POSIXct](https://stackoverflow.com/questions/35172317/how-to-create-a-matrix-of-posixct) – kangaroo_cliff Dec 02 '20 at 11:47

0 Answers0