13109

Timezone issue when filtering XTS using .indexhour

The following R code returns an unexpected output:

times = c("2014-12-01 15:59:00", "2014-12-01 16:00:00", "2014-12-01 16:01:00") values = c(64.23, 64.43, 64.31) tim <- as.POSIXct(c("2014-12-01 15:59:00", "2014-12-01 16:00:00", "2014-12-01 16:01:00"), tz="GMT") myts <- xts(values, tim, tzone="GMT") print(myts[.indexhour(myts)==16])

I get:

[,1] 2014-12-01 15:59:00 64.23

While I would expect:

[,1] 2014-12-01 16:00:00 64.43 2014-12-01 16:01:00 64.31

I think .indexhour is somehow referring to my local timezone, while I obviously expect it to use the XTS object timezone.

Is there anything I can do to fix it?

Answer1:

This is bug #5891 and has been patched on R-Forge as of revision 844.

Recommend

  • How to calculate UTC offset from IANA timezone name in C
  • R - Conditional operations on time variables and dates
  • custom axis labels plotting a forecast in R
  • Can you define a custom collation using a function in XSLT?
  • Python: Cross-platform solution to detect physical non-HT CPUs?
  • How can I handle ArrowKeys and < (Greater Than) in a Javascript function? Which event and which c
  • getting the current time at specific timezone
  • passing string to ggplot function
  • Android - FM/Radio Transmitting
  • R: how to resample a datetime variable at the millisecond level?
  • From daily time series to weekly time series in R xts object
  • Gracefull shutdown for Spring boot Application
  • time_t conversion format question
  • toInstant() in Calendar is showing in GMT instead of Local time
  • Convert unix time to week day
  • date format change with DT and shiny
  • How to plot large time series (thousands of administration times/doses of a medication)?
  • CXF JAXB JAXBEncoderDecoder unmarshalling error : unexpected element when having qualified elements
  • Unexpected token ILLEGAL while running node.js mocha test
  • Scipy Leastsq Optional Output Variable (Mesg)
  • Trying to get the char code of ENTER key
  • Dynamically switching connect in Modelica
  • calculate gradient output for Theta update rule
  • Access variable of ScriptContext using Nashorn JavaScript Engine (Java 8)
  • Problem while Building a Setup Project for a windows Service?
  • How to attach a node.js readable stream to a Sendgrid email?
  • Functions in global context
  • Unity3D & Android: Difference between “UnityMain” and “main” threads?
  • Why value captured by reference in lambda is broken? [duplicate]
  • output of program is not same as passed argument
  • Modifying destination and filename of gulp-svg-sprite
  • Deserializing XML into class C#
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • python draw pie shapes with colour filled
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal