[R] Reading and converting time data via read.table

William Dunlap wdunlap at tibco.com
Thu Jun 9 19:30:55 CEST 2016


>In fact, I learned most of them the hard way
>by trial and error and realized that it’s difficult to separate time and
>date using POSIXct and POSIXlt.

It is difficult to separate time from data in real life as well.  The most
common problem is when your time zone switches between 'daylight
savings' ('summer') and 'standard' ('winter') each spring and fall.

You can attach your time to a fake date and arrange to only print the
time portion, but since you have a date, use it.




Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Jun 8, 2016 at 10:40 PM, Ek Esawi <esawiek at gmail.com> wrote:

> Thank you Jeff and Don. As I stated on my original posting that I am
> relatively new to R. After a few weeks of searching and reading I have come
> to the same point that Don made which is base R doesn’t have a class for
> time only. I explored the chron and lubridate packages and even looked at
> Ecfun
> package; the latter is too long and I did not have time to experiment with
> it. I think the lubridate package might be useful for this; but again I did
> not want to get into many packages. So I tried chron using the times
> function that produced what I want. Indeed as Don said, I could not figure
> out how to use it in a read.table; so I had already decided to do what Don
> suggested which is read them as character then convert them one vector at a
> time to time class.
>
>
>
> What do I need this stuff for? Well, I published a paper 6 months ago where
> I had to deal with time data and needed to convert and manipulate time
> data. I did all that work in Excel and it took too long; so I want to learn
> R for future research and use the same data using R.
>
>
>
> I agree with Jeff’s comments. In fact, I learned most of them the hard way
> by trial and error and realized that it’s difficult to separate time and
> date using POSIXct and POSIXlt.
>
>
>
> Thanks again----EK
>
>         [[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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list