[R] Reading and converting time data via read.table
Spencer Graves
spencer.graves at effectivedefense.org
Wed Jun 8 04:45:53 CEST 2016
Have you considered asNumericDF in the Ecfun package? This can
convert to a date-time column into POSIXct -- not POSIXlt -- using the
POSIX argument to identify the POSIX columns and format to provide the
"format" argument for as.POSIXct.
I suggest you try the R-Forge version: install.packages("Ecfun",
repos="http://R-Forge.R-project.org"). If I recall correctly, the
R-Forge version works the same as the CRAN version for POSIX but fixes a
subtle bug for Dates.
Hope this helps.
Spencer Graves
p.s. If anyone knows a better way to do this, I'm interested.
On 6/7/2016 5:26 PM, Ek Esawi wrote:
> Thanks Petr!
>
>
>
> I am still unable to come up with a conversion formula/trick to convert my
> time data to POSIXlt which then can be used in read.table. Below are again
> a few lines from my file. Since as you see there are several columns of
> time data ONLY (no date), I am hoping that there is a way to convert the
> time columns to POSIXlt or chron in the read.table statement. I was able to
> use as.Date in the read.table to convert the dates.
>
>
> Thanks-EK
>
>
>
> O Date Name Time Inter Dura Prep Hht
> Pred
>
> 1 312171 7/1/1995 Old-1 13:37 1:43 4:42 13:16 162
> 13:19
>
> 2 358237 5/25/1993 Old-2 12:22 1:31 4:16 12:03 160
> 12:13
>
> 3 339971 7/17/1994 Old-3 15:54 1:23 4:36 15:43 160
> 15:51
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
More information about the R-help
mailing list