Re: [R] generating a sequence of seconds

2014-08-12 Thread Erin Hodgess
Great! Thank you! I think the function with the C-like function should do the trick. On Tue, Aug 12, 2014 at 4:31 PM, John McKown wrote: > On Tue, Aug 12, 2014 at 3:23 PM, William Dunlap wrote: > >> > Again, in my opinion, all time date should be recorded in GMT. >> >> It depends on conte

Re: [R] generating a sequence of seconds

2014-08-12 Thread John McKown
On Tue, Aug 12, 2014 at 3:23 PM, William Dunlap wrote: > > Again, in my opinion, all time date should be recorded in GMT. > > It depends on context. If you are studying traffic flow or > electricity usage, then you want local time with all its warts > (perhaps stated as time since 3am so any da

Re: [R] generating a sequence of seconds

2014-08-12 Thread William Dunlap
> Again, in my opinion, all time date should be recorded in GMT. It depends on context. If you are studying traffic flow or electricity usage, then you want local time with all its warts (perhaps stated as time since 3am so any daylight savings time problems are confined to a small portion of th

Re: [R] generating a sequence of seconds

2014-08-12 Thread Bert Gunter
Marc: You just need to be more patient -- this is already happening: http://en.wikipedia.org/wiki/Tidal_acceleration Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." Cliff

Re: [R] generating a sequence of seconds

2014-08-12 Thread John McKown
On Tue, Aug 12, 2014 at 2:26 PM, Erin Hodgess wrote: > What I would like to do is to look at several days and determine activities > that happened at times on those days. I don't really care which days, I > just care about what time. > > Thank you! > Ah! A light dawns. You want to subset your da

Re: [R] generating a sequence of seconds

2014-08-12 Thread Marc Schwartz
On Aug 12, 2014, at 2:49 PM, John McKown wrote: > And some people wonder why I absolutely abhor daylight saving time. > I'm not really fond of leap years and leap seconds either. Somebody > needs to fix the Earth's rotation and orbit! I have been a longtime proponent of slowing the rotation of

Re: [R] generating a sequence of seconds

2014-08-12 Thread John McKown
And some people wonder why I absolutely abhor daylight saving time. I'm not really fond of leap years and leap seconds either. Somebody needs to fix the Earth's rotation and orbit! On Tue, Aug 12, 2014 at 2:14 PM, William Dunlap wrote: >> What if I just want the seconds vector without the date, p

Re: [R] generating a sequence of seconds

2014-08-12 Thread John McKown
On Tue, Aug 12, 2014 at 2:40 PM, John McKown wrote: > You can simply make that a function > > getTimePortion <- function(POSIXct_value) { > value_in_seconds=as.integer(POSIXct_value); > sprintf("%02d:%02d:%02d", # C-style > formatting string

Re: [R] generating a sequence of seconds

2014-08-12 Thread Marc Schwartz
Erin, Is a sequential resolution of seconds required, as per your original post? If so, then using my approach and specifying the start and end dates and times will work, with the coercion of the resultant vector to numeric as I included. The method I used (subtracting the first value) will als

Re: [R] generating a sequence of seconds

2014-08-12 Thread John McKown
On Tue, Aug 12, 2014 at 1:51 PM, Erin Hodgess wrote: > Hello! > > If I would like to generate a sequence of seconds for a date, I would do > the following: > > x <- seq(from=as.POSIXct(2014-08-12 00:00:00),to=as.POSIXct(2014-08-12 > 23:59:59),by="secs") > > What if I just want the seconds vector w

Re: [R] generating a sequence of seconds

2014-08-12 Thread William Dunlap
If your activities of interest are mainly during the workday then seconds-since-3am might give good results, avoiding most daylight savings time issues. If they are more biologically oriented then something like seconds before or after sunrise or sunset might be better. Both can be expressed as d

Re: [R] generating a sequence of seconds

2014-08-12 Thread Erin Hodgess
What I would like to do is to look at several days and determine activities that happened at times on those days. I don't really care which days, I just care about what time. Thank you! On Tue, Aug 12, 2014 at 3:14 PM, William Dunlap wrote: > > What if I just want the seconds vector without

Re: [R] generating a sequence of seconds

2014-08-12 Thread William Dunlap
> What if I just want the seconds vector without the date, please? Is there > a convenient way to create such a vector, please? Why do you want such a thing? E.g., do you want it to print the time of day without the date? Or are you trying to avoid numeric problems when you do regressions with

Re: [R] generating a sequence of seconds

2014-08-12 Thread Marc Schwartz
On Aug 12, 2014, at 1:51 PM, Erin Hodgess wrote: > Hello! > > If I would like to generate a sequence of seconds for a date, I would do > the following: > > x <- seq(from=as.POSIXct(2014-08-12 00:00:00),to=as.POSIXct(2014-08-12 > 23:59:59),by="secs") > > What if I just want the seconds vector

[R] generating a sequence of seconds

2014-08-12 Thread Erin Hodgess
Hello! If I would like to generate a sequence of seconds for a date, I would do the following: x <- seq(from=as.POSIXct(2014-08-12 00:00:00),to=as.POSIXct(2014-08-12 23:59:59),by="secs") What if I just want the seconds vector without the date, please? Is there a convenient way to create such a