I have a column in which dates and times are specified thus
m/d/yyyy HH:MM:SS
Alas, some entries do not include the time and therefore are only
m/d/yyyy
so I used read.csv and specified that the relevant column should be read as
is and it remained as a character variable.
I then split the value on the space
split.dt.time <-strsplit(teacher$Date.and.Time.of.Lesson," ")
that gives me a list where each item on the list has two elements if the
time was specified and only 1 element if the time was not specified.
How do I take that list and make all the 1st elements go into one column and
all the second elements go into a second column; where there is no time I
would like the value to be missing (NA)
I tried playing around with do.call(rbind...

so I tried the following unsuccessfully
do.call(rbind,lapply(teacher$Date.and.Time.of.Lesson, function(i)
strsplit(i," ")) )
rbind(strsplit (teacher$Date.and.Time.of.Lesson," "))
do.call(rbind(data.frame(strsplit (teacher$Date.and.Time.of.Lesson," "))))


Farrel Buchinsky

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to