-1

Is there a command the will give me the value of the xts at a specific time each day? My data is in xts format with data/time format being yyyy-mm-dd hh:mm:ss. For example i would like to only pull the data at time 13:00:00. Any suggestions? I tried using the to.period function to no avail

My Data is in the formats:

Date/Time                Value
2013-08-11   09:00:00    1
2013-08-11   09:01:00    2
2013-08-12   09:00:00    3
2013-08-12   09:01:00    7
2013-08-13   09:00:00    9
2013-08-13   09:01:00    7

So basically I want to grab only the Date/Time that has a 09:00:00 in it. So the answer should be

2013-08-11   09:00:00    1
2013-08-12   09:00:00    3
2013-08-13   09:00:00    9

I tried using theData['09:00:00'] but that only retruns my columns names. to.daily

Junior R
  • 93
  • 2
  • 12
  • ive tried those functions but they dont work – Junior R Aug 17 '13 at 15:35
  • 3
    "They don't work" is entirely unhelpful. You show no code and no error and we aren't clairvoyant. See [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask) and the [StackOverflow question checklist](http://meta.stackexchange.com/q/156810). – Joshua Ulrich Aug 17 '13 at 15:40
  • You have to follow the documentation of `?.parseISO8601` exactly, "Recurring times over multiple days may be specified using the "T" notation. See the examples for details." The leading `"T"` matters and you must specify a *range*, not just a single time point. Also note the "Note" section, "There is no checking done to test for a properly constructed ISO format string. This must be correctly entered by the user, lest bad things may happen." – Joshua Ulrich Aug 17 '13 at 15:57
  • 1
    I vote we close. This person has asked 8 questions and accepted zero answers. He/she has failed to provide code and data across multiple questions (despite being asked) and clearly hasn't spent the time to read how use Stack Overflow (despite numerous pointers to the key posts/questions). In summary, he/she is showing no individual effort and the questions are not contributing to SO. Waste of the community's time. – SlowLearner Aug 17 '13 at 16:23

1 Answers1

2

An example of what Joshua's getting at in his comment...

Use the "T" notation and specify a range

theData["T09:00:00.000/T09:00:00.001"]

Another way:

theData[.indexhour(theData)==9 & .indexmin(theData)==0 & .indexsec(theData)==0]
GSee
  • 48,880
  • 13
  • 125
  • 145