Hi everyone,

I have bunch of date and time observations in the format %Y-%m-%d %I %M %S
%p. I used strptime() to read this format. But the problem is some of the
times are in the format of  %I %M %p, so for those times, strptime is giving
me NA values.

For example,

strptime(paste("2009-04-08","1:49:47 PM"),format="%Y-%m-%d %I:%M:%S %p")

[1] "2009-04-08 13:49:47"


But

strptime(paste("2009-04-08","1:49 PM"),format="%Y-%m-%d %I:%M:%S %p")

[1] NA

Now I have approximately 10000 observations, so I can't go through all the
observations individually in order to find which row in the array has this
format.

Can anyone suggest me how to handle this issue? Is there any way to convert
%I %M %p format to %I %M %S %p?

Thanks in advance for the help.

Cassie

        [[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