6

I would like to split "2015-05-13T20:41:29+0000" into 2015-05 and 20:41:29+0000. I tried the following:

> strsplit("2015-05-13T20:41:29+0000",split="-\\d\\dT",fixed=TRUE)
[[1]]
[1] "2015-05-13T20:41:29+0000"

but the pattern is not matched. How to fix this?

Leonardo
  • 297
  • 4
  • 11

1 Answers1

6

You can remove the fixed since you are not using exact matching,

strsplit("2015-05-13T20:41:29+0000",split="-\\d{2}T")
# [[1]]
# [1] "2015-05"       "20:41:29+0000"
Rorschach
  • 28,468
  • 5
  • 66
  • 112