Reputation: 337
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?
Upvotes: 6
Views: 4050
Reputation: 32426
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"
Upvotes: 6