I have tried my best using the split function and others, but to no avail.
Asked
Active
Viewed 65 times
-3
-
Please show us your attempt. – James Feb 17 '16 at 09:27
-
Why did you remove the example? Without it, the question is unclear – talat Feb 17 '16 at 09:53
1 Answers
0
We can use read.table/read.csv
with the sep
option.
read.table(text=as.character(df1$datetime), sep=' ',
col.names=c('date', 'time'),
header=FALSE, stringsAsFactors=FALSE)
# date time
#1 01/01/2011 0:00
#2 01/01/2011 1:00
#3 01/01/2011 2:00
#4 01/01/2011 3:00
#5 01/01/2011 4:00
Or with tidyr
library(tidyr)
separate(df1, datetime, into= c('date', 'time'), sep=' ')

akrun
- 874,273
- 37
- 540
- 662