Re: [R] how to work with time of day (independent of date)

2015-10-30 Thread Jeff Newmiller
Sys.setenv( TZ="Etc/GMT+8" )

executed before converting to POSIXct works for me, though using that string 
with the tz parameter also works. You should read ?Sys.timezone. For windows, 
look at the files in C:\Program Files\R\R-3.2.2\share\zoneinfo and note that 
PST is not defined though PST8PDT is.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On October 30, 2015 12:30:22 PM PDT, Clint Bowman  wrote:
>Bill,
>
>Your final words, "changes in spring and fall" reminds me of a problem 
>I have yet to solve.  Most of my data is logged in standard time (no 
>daylight times) but often I see the note "daylight time encountered 
>switching to UTC" even when I've specified "tz="PST".
>
>I hope I've been missing something simple--any suggestions?
>
>TIA
>
>Clint
>
>Clint Bowman   INTERNET:   cl...@ecy.wa.gov
>Air Quality ModelerINTERNET:   cl...@math.utah.edu
>Department of Ecology  VOICE:  (360) 407-6815
>PO Box 47600   FAX:(360) 407-7534
>Olympia, WA 98504-7600
>
> USPS:   PO Box 47600, Olympia, WA 98504-7600
> Parcels:300 Desmond Drive, Lacey, WA 98503-1274
>
>On Fri, 30 Oct 2015, William Dunlap wrote:
>
>> You can use difftime objects to get the amount of time since the
>start of
>> the current day.  E.g.,
>>  > dateTime <- as.POSIXlt( c("2015-10-29 00:50:00",
>>  + "2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30
>00:50:00",
>>  + "2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31
>00:50:00",
>>  + "2015-10-31 10:30:00"))
>>  > date <- trunc(dateTime, units="days")
>>  > sinceMidnight <- difftime(dateTime, date, units="mins")
>>  > sinceMidnight
>>  Time differences in mins
>>  [1]   50  570 1270   50  570 1270   50  630
>>
>> I use difftime(x, y, units=) instead of the similar x-y because the
>latter
>> chooses
>> the units based on how far apart x and y are, while the former gives
>me
>> consistent
>> units:
>>  > dateTime[1] - date[1]
>>  Time difference of 50 mins
>>  > as.numeric(.Last.value)
>>  [1] 50
>>  > dateTime[5:6] - date[5:6]
>>  Time differences in hours
>>  [1]  9.5 21.16667
>>  > as.numeric(.Last.value)
>>  [1]  9.5 21.16667
>>
>> Depending on what you are using this for, you might want to compute
>time
>> since 3am
>> of the current day so you don't get discontinuities for most times
>when the
>> time
>> changes in spring and fall.
>>
>>
>>
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>>
>> On Fri, Oct 30, 2015 at 10:35 AM, Daniel Nordlund
>
>> wrote:
>>
>>> I have a data frame with date/times represented as charaacter
>strings and
>>> and a value at that date/time.  I want to get the mean value for
>each time
>>> of day, across days, and then plot time of day on the x-axis and
>means on
>>> the y-axis.  R doesn't appear to have a built-in time of day time
>type
>>> (independent of a date), unless I have missed something. What is the
>best
>>> way to create a time variable so that I can aggregate and plot by
>time of
>>> day, with time labelled in HH:MM format.  My current approach is to
>convert
>>> all date/times to the same date.  I can then manage the rest of what
>I want
>>> with ggplot2.  But I am  wondering if there is an easier/better way
>to do
>>> deal with time of day.
>>>
>>> Here is a sample data frame.
>>>
>>> df <- structure(list(date = structure(1:8, .Label = c("2015-10-29
>>> 00:50:00",
>>> "2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
>>> "2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
>>> "2015-10-31 10:30:00"), class = "factor"), value = c(88L, 17L,
>>> 80L, 28L, 23L, 39L, 82L, 79L)), .Names = c("date", "value"),
>row.names =
>>> c(NA,
>>> -8L), class = "data.frame")
>>>
>>>
>>> Any suggestions appreciated.
>>>
>>> Dan
>>>
>>> --
>>> Daniel Nordlund
>>> Bothell, WA  USA
>>>
>>> __
>>> R-help@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]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read 

Re: [R] how to work with time of day (independent of date)

2015-10-30 Thread Daniel Nordlund

On 10/30/2015 11:17 AM, Mark Leeds wrote:

Daniel: Just to complete my solution, here's the code for doing the
mean. Didn't expect this to take 3 emails !!! Have a good weekend.

temp <- tapply(f$value, f$justtimes, mean)
finalDF <- data.frame(chrontimes = times(rownames(temp)), values = temp)
plot(values ~ chrontimes, data = finalDF)





On Fri, Oct 30, 2015 at 2:09 PM, Mark Leeds > wrote:

Hi Daniel: I forgot that you wanted the mean so my code doesn't do
exactly what you asked for but you can use jim's code for that part.
His substring approach is also good but maybe
the chron approach is more general ? Sorry for confusion.




On Fri, Oct 30, 2015 at 2:07 PM, Mark Leeds > wrote:

Hi Daniel:  Assuming that you don't have to deal with time
zones, then you can use a chron object which has a seperate
field for the time.  See below for how to convert to just times.
I sent privately in order to not keep others from sending since
there may  be other ways. But, if you're okay with just this,
then you can just send to list to close out thread. No credit
needed. All the best.


library(chron)

f <- structure(list(date = structure(1:8, .Label = c("2015-10-29
00:50:00",
"2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
"2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
"2015-10-31 10:30:00"), class = "factor"), value = c(88L, 17L,
80L, 28L, 23L, 39L, 82L, 79L)), .Names = c("date", "value"),
row.names = c(NA,
-8L), class = "data.frame")

print(f)

f$dateandtimes <-
as.chron(as.POSIXct(as.character(f$date),format = "%Y-%m-%d
%H:%M:%S"))
print(f)

f$justtimes <- times(as.numeric(f$dateandtimes) %% 1)
print(f)

plot(value ~ justtimes, data = f)

On Fri, Oct 30, 2015 at 1:35 PM, Daniel Nordlund
> wrote:

I have a data frame with date/times represented as
charaacter strings and and a value at that date/time.  I
want to get the mean value for each time of day, across
days, and then plot time of day on the x-axis and means on
the y-axis.  R doesn't appear to have a built-in time of day
time type (independent of a date), unless I have missed
something. What is the best way to create a time variable so
that I can aggregate and plot by time of day, with time
labelled in HH:MM format.  My current approach is to convert
all date/times to the same date.  I can then manage the rest
of what I want with ggplot2.  But I am  wondering if there
is an easier/better way to do deal with time of day.

Here is a sample data frame.

df <- structure(list(date = structure(1:8, .Label =
c("2015-10-29 00:50:00",
"2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30
00:50:00",
"2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31
00:50:00",
"2015-10-31 10:30:00"), class = "factor"), value = c(88L, 17L,
80L, 28L, 23L, 39L, 82L, 79L)), .Names = c("date", "value"),
row.names = c(NA,
-8L), class = "data.frame")


Any suggestions appreciated.

Dan

--
Daniel Nordlund
Bothell, WA  USA

__
R-help@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.






Thanks to all who responded (both on and off list).  Several useful 
suggestions were presented.  It looks like using the chron package may 
get me what I want, but I will play with all the solutions to see what 
works best for me.



Dan

--
Daniel Nordlund
Bothell, WA  USA

__
R-help@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.


Re: [R] how to work with time of day (independent of date)

2015-10-30 Thread Clint Bowman

Bill,

Your final words, "changes in spring and fall" reminds me of a problem 
I have yet to solve.  Most of my data is logged in standard time (no 
daylight times) but often I see the note "daylight time encountered 
switching to UTC" even when I've specified "tz="PST".


I hope I've been missing something simple--any suggestions?

TIA

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 30 Oct 2015, William Dunlap wrote:


You can use difftime objects to get the amount of time since the start of
the current day.  E.g.,
 > dateTime <- as.POSIXlt( c("2015-10-29 00:50:00",
 + "2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
 + "2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
 + "2015-10-31 10:30:00"))
 > date <- trunc(dateTime, units="days")
 > sinceMidnight <- difftime(dateTime, date, units="mins")
 > sinceMidnight
 Time differences in mins
 [1]   50  570 1270   50  570 1270   50  630

I use difftime(x, y, units=) instead of the similar x-y because the latter
chooses
the units based on how far apart x and y are, while the former gives me
consistent
units:
 > dateTime[1] - date[1]
 Time difference of 50 mins
 > as.numeric(.Last.value)
 [1] 50
 > dateTime[5:6] - date[5:6]
 Time differences in hours
 [1]  9.5 21.16667
 > as.numeric(.Last.value)
 [1]  9.5 21.16667

Depending on what you are using this for, you might want to compute time
since 3am
of the current day so you don't get discontinuities for most times when the
time
changes in spring and fall.



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Oct 30, 2015 at 10:35 AM, Daniel Nordlund 
wrote:


I have a data frame with date/times represented as charaacter strings and
and a value at that date/time.  I want to get the mean value for each time
of day, across days, and then plot time of day on the x-axis and means on
the y-axis.  R doesn't appear to have a built-in time of day time type
(independent of a date), unless I have missed something. What is the best
way to create a time variable so that I can aggregate and plot by time of
day, with time labelled in HH:MM format.  My current approach is to convert
all date/times to the same date.  I can then manage the rest of what I want
with ggplot2.  But I am  wondering if there is an easier/better way to do
deal with time of day.

Here is a sample data frame.

df <- structure(list(date = structure(1:8, .Label = c("2015-10-29
00:50:00",
"2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
"2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
"2015-10-31 10:30:00"), class = "factor"), value = c(88L, 17L,
80L, 28L, 23L, 39L, 82L, 79L)), .Names = c("date", "value"), row.names =
c(NA,
-8L), class = "data.frame")


Any suggestions appreciated.

Dan

--
Daniel Nordlund
Bothell, WA  USA

__
R-help@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]]

__
R-help@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.



__
R-help@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.


[R] how to work with time of day (independent of date)

2015-10-30 Thread Daniel Nordlund
I have a data frame with date/times represented as charaacter strings 
and and a value at that date/time.  I want to get the mean value for 
each time of day, across days, and then plot time of day on the x-axis 
and means on the y-axis.  R doesn't appear to have a built-in time of 
day time type (independent of a date), unless I have missed something. 
What is the best way to create a time variable so that I can aggregate 
and plot by time of day, with time labelled in HH:MM format.  My current 
approach is to convert all date/times to the same date.  I can then 
manage the rest of what I want with ggplot2.  But I am  wondering if 
there is an easier/better way to do deal with time of day.


Here is a sample data frame.

df <- structure(list(date = structure(1:8, .Label = c("2015-10-29 
00:50:00",

"2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
"2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
"2015-10-31 10:30:00"), class = "factor"), value = c(88L, 17L,
80L, 28L, 23L, 39L, 82L, 79L)), .Names = c("date", "value"), row.names = 
c(NA,

-8L), class = "data.frame")


Any suggestions appreciated.

Dan

--
Daniel Nordlund
Bothell, WA  USA

__
R-help@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.


Re: [R] how to work with time of day (independent of date)

2015-10-30 Thread jim holtman
is this what you want:

> df <- structure(list(date = structure(1:8, .Label = c("2015-10-29
00:50:00",
+ "2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
+ "2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
+ "2015-10-31 10:30:00"), class = "factor"), value = c(88L, 17L,
+ 80L, 28L, 23L, 39L, 82L, 79L)), .Names = c("date", "value"), row.names =
c(NA,
+ -8L), class = "data.frame")
>
> # extract just the time and summarize by it
> tapply(df$value, substring(df$date, 12, 16), mean)
00:50 09:30 10:30 21:10
 66.0  20.0  79.0  59.5



Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Fri, Oct 30, 2015 at 1:35 PM, Daniel Nordlund 
wrote:

> I have a data frame with date/times represented as charaacter strings and
> and a value at that date/time.  I want to get the mean value for each time
> of day, across days, and then plot time of day on the x-axis and means on
> the y-axis.  R doesn't appear to have a built-in time of day time type
> (independent of a date), unless I have missed something. What is the best
> way to create a time variable so that I can aggregate and plot by time of
> day, with time labelled in HH:MM format.  My current approach is to convert
> all date/times to the same date.  I can then manage the rest of what I want
> with ggplot2.  But I am  wondering if there is an easier/better way to do
> deal with time of day.
>
> Here is a sample data frame.
>
> df <- structure(list(date = structure(1:8, .Label = c("2015-10-29
> 00:50:00",
> "2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
> "2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
> "2015-10-31 10:30:00"), class = "factor"), value = c(88L, 17L,
> 80L, 28L, 23L, 39L, 82L, 79L)), .Names = c("date", "value"), row.names =
> c(NA,
> -8L), class = "data.frame")
>
>
> Any suggestions appreciated.
>
> Dan
>
> --
> Daniel Nordlund
> Bothell, WA  USA
>
> __
> R-help@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]]

__
R-help@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.


Re: [R] how to work with time of day (independent of date)

2015-10-30 Thread William Dunlap
You can use difftime objects to get the amount of time since the start of
the current day.  E.g.,
  > dateTime <- as.POSIXlt( c("2015-10-29 00:50:00",
  + "2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
  + "2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
  + "2015-10-31 10:30:00"))
  > date <- trunc(dateTime, units="days")
  > sinceMidnight <- difftime(dateTime, date, units="mins")
  > sinceMidnight
  Time differences in mins
  [1]   50  570 1270   50  570 1270   50  630

I use difftime(x, y, units=) instead of the similar x-y because the latter
chooses
the units based on how far apart x and y are, while the former gives me
consistent
units:
  > dateTime[1] - date[1]
  Time difference of 50 mins
  > as.numeric(.Last.value)
  [1] 50
  > dateTime[5:6] - date[5:6]
  Time differences in hours
  [1]  9.5 21.16667
  > as.numeric(.Last.value)
  [1]  9.5 21.16667

Depending on what you are using this for, you might want to compute time
since 3am
of the current day so you don't get discontinuities for most times when the
time
changes in spring and fall.



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Oct 30, 2015 at 10:35 AM, Daniel Nordlund 
wrote:

> I have a data frame with date/times represented as charaacter strings and
> and a value at that date/time.  I want to get the mean value for each time
> of day, across days, and then plot time of day on the x-axis and means on
> the y-axis.  R doesn't appear to have a built-in time of day time type
> (independent of a date), unless I have missed something. What is the best
> way to create a time variable so that I can aggregate and plot by time of
> day, with time labelled in HH:MM format.  My current approach is to convert
> all date/times to the same date.  I can then manage the rest of what I want
> with ggplot2.  But I am  wondering if there is an easier/better way to do
> deal with time of day.
>
> Here is a sample data frame.
>
> df <- structure(list(date = structure(1:8, .Label = c("2015-10-29
> 00:50:00",
> "2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
> "2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
> "2015-10-31 10:30:00"), class = "factor"), value = c(88L, 17L,
> 80L, 28L, 23L, 39L, 82L, 79L)), .Names = c("date", "value"), row.names =
> c(NA,
> -8L), class = "data.frame")
>
>
> Any suggestions appreciated.
>
> Dan
>
> --
> Daniel Nordlund
> Bothell, WA  USA
>
> __
> R-help@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]]

__
R-help@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.


Re: [R] how to work with time of day (independent of date)

2015-10-30 Thread William Dunlap
I get confused by this also, but I believe your time zone is US/Pacific,
which
specifies both the offset from UTC and the dates on which we switch between
'standard' (winter) and 'daylight savings' (summer).  I think you would have
to create a new time zone entry that is always UTC+8 hours, or whatever,
if you want to use standard time at all times.

I usually lie and use tz="UTC" when using data in local standard time (e.g.,
tide tables in the US).


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Oct 30, 2015 at 12:30 PM, Clint Bowman  wrote:

> Bill,
>
> Your final words, "changes in spring and fall" reminds me of a problem I
> have yet to solve.  Most of my data is logged in standard time (no daylight
> times) but often I see the note "daylight time encountered switching to
> UTC" even when I've specified "tz="PST".
>
> I hope I've been missing something simple--any suggestions?
>
> TIA
>
> Clint
>
> Clint BowmanINTERNET:   cl...@ecy.wa.gov
> Air Quality Modeler INTERNET:   cl...@math.utah.edu
> Department of Ecology   VOICE:  (360) 407-6815
> PO Box 47600FAX:(360) 407-7534
> Olympia, WA 98504-7600
>
> USPS:   PO Box 47600, Olympia, WA 98504-7600
> Parcels:300 Desmond Drive, Lacey, WA 98503-1274
>
> On Fri, 30 Oct 2015, William Dunlap wrote:
>
> You can use difftime objects to get the amount of time since the start of
>> the current day.  E.g.,
>>  > dateTime <- as.POSIXlt( c("2015-10-29 00:50:00",
>>  + "2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
>>  + "2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
>>  + "2015-10-31 10:30:00"))
>>  > date <- trunc(dateTime, units="days")
>>  > sinceMidnight <- difftime(dateTime, date, units="mins")
>>  > sinceMidnight
>>  Time differences in mins
>>  [1]   50  570 1270   50  570 1270   50  630
>>
>> I use difftime(x, y, units=) instead of the similar x-y because the latter
>> chooses
>> the units based on how far apart x and y are, while the former gives me
>> consistent
>> units:
>>  > dateTime[1] - date[1]
>>  Time difference of 50 mins
>>  > as.numeric(.Last.value)
>>  [1] 50
>>  > dateTime[5:6] - date[5:6]
>>  Time differences in hours
>>  [1]  9.5 21.16667
>>  > as.numeric(.Last.value)
>>  [1]  9.5 21.16667
>>
>> Depending on what you are using this for, you might want to compute time
>> since 3am
>> of the current day so you don't get discontinuities for most times when
>> the
>> time
>> changes in spring and fall.
>>
>>
>>
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>>
>> On Fri, Oct 30, 2015 at 10:35 AM, Daniel Nordlund <
>> djnordl...@frontier.com>
>> wrote:
>>
>> I have a data frame with date/times represented as charaacter strings and
>>> and a value at that date/time.  I want to get the mean value for each
>>> time
>>> of day, across days, and then plot time of day on the x-axis and means on
>>> the y-axis.  R doesn't appear to have a built-in time of day time type
>>> (independent of a date), unless I have missed something. What is the best
>>> way to create a time variable so that I can aggregate and plot by time of
>>> day, with time labelled in HH:MM format.  My current approach is to
>>> convert
>>> all date/times to the same date.  I can then manage the rest of what I
>>> want
>>> with ggplot2.  But I am  wondering if there is an easier/better way to do
>>> deal with time of day.
>>>
>>> Here is a sample data frame.
>>>
>>> df <- structure(list(date = structure(1:8, .Label = c("2015-10-29
>>> 00:50:00",
>>> "2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
>>> "2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
>>> "2015-10-31 10:30:00"), class = "factor"), value = c(88L, 17L,
>>> 80L, 28L, 23L, 39L, 82L, 79L)), .Names = c("date", "value"), row.names =
>>> c(NA,
>>> -8L), class = "data.frame")
>>>
>>>
>>> Any suggestions appreciated.
>>>
>>> Dan
>>>
>>> --
>>> Daniel Nordlund
>>> Bothell, WA  USA
>>>
>>> __
>>> R-help@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]]
>>
>> __
>> R-help@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]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do