Menu
  • HOME
  • TAGS

R Multiple condition when looping through matrices and storing results with correct date attached

r,loops,if-statement,matrix,xts

You can multiply MN with AB > CD MN*(AB > CD) # M N #2014-11-28 0.011121659 -0.008108887 #2014-11-29 0.003625899 0.000000000 data MN <- structure(c(0.0111216585957413, 0.00362589897053931, -0.00810888676554509, -0.0294378988830602), .Dim = c(2L, 2L), .Dimnames = list(NULL, c("M", "N")), index = structure(c(1417132800, 1417219200), tzone = "UTC", tclass = "Date"), class = c("xts", "zoo"),...

Use of lag function

r,xts

Okay, your last comment gets at some of the confusion: We have two signal vector, the old one (11,11,11,11,11) and the new one we are creating: signal = ifelse...etc. In R, you can't reference a new variable as it is being created, you have to finish creating it first. That...

How can I preserve xts format for fitted data after regression?

r,regression,xts

In my tests, fitted(inputfit) returned the same thing (a named numeric vector) whether I ran lm on a ts object or an xts object. So I'm skeptical that a ts object is really being returned. Regardless, you can convert the output of fitted(inputfit) back to xts using as.xts: > head(as.xts(fitted(inputfit),...

set dimnames of an xts object with the names of certain elements in a list through loop

r,for-loop,xts,names

I couldn't test this, because you didn't provide a reproducible example, but I think it should work. Basically, you need to construct a dimname list and set it in the xts constructor. library(xts) weekly <- NULL monthly <- NULL for (i in seq_along(terms.list)) { term <- terms.list[[i]] dimNames <- list(NULL,...

Interpolate a correction vector for xts object in R. Subtract background level from values

r,time-series,xts

Problem can be solved by adding a UNIX time-stamp format from existing xts index. Then it is easy to calculate the middles of time series as the means of second counts. UNIX seconds also make building the vector easy, as simple algebra can be used to find the needed slope...

R // QuantStrat package - hasTsp(x): invalid time series parameters specified Error

r,xts,quantstrat

Finally I have found an answer to my question. The problem is that strptime() converts my chart to POSIXlt time format. Apparently only POSIXct format is working. Therefore you just have to use as.POSIXct() to solve the problem. Modified example: as.POSIXct(strptime(GBPUSD$V2,"%Y%m%d %H:%M:%S"))....

How to sum each row in a .xts object, where values are NOT missing

r,xts,na,data-manipulation

is.na is a function, you should use which(!is.na(live[x,])) ...

Use dygraph for R to plot xts time series by year only?

r,xts

This looks like a bug in as.xts.ts. It uses length(x) to create the sequence of dates for the index, which returns the number of elements for a matrix (not the number of rows). You can work around it by using as.xts on your ts objects before calling cbind on them....

R - FinancialInstrument Package Changing Symbol Names when using stock

r,xts,quantstrat,blotter

instrument names need to begin with a letter or a dot. The instrument function uses make.names to ensure this. If it's important to be able to find your instruments by a number, then you can add it as an identifier. stock("X1234", currency("USD"), identifiers=list(num=1234)) getInstrument("1234") #primary_id :"X1234" #currency :"USD" #multiplier :1...

Analyse data based on date

r,xts

Here's a possibility to get you started with the "xts" package. Start with some sample data, as a data.frame: mydf <- structure(list(Date = c("28-04-14", "28-04-14", "28-04-14", "28-04-14", "29-04-14", "29-04-14", "29-04-14"), Time = c("23:42:30", "23:47:00", "23:51:30", "23:56:00", "00:00:00", "00:04:30", "00:09:00"), col3 = c(0.48, 0.39, 0.41, 0.33, 0.32, 0.15, 0.12), col4 =...

How to do cumulative logical operations on mutliple columns

r,xts

Here's an another alternative that seems to be a bit faster than @AnadaMahto's solution (on this example). You might also find it a bit more straightforward. R> rowMeans(apply(x > 50, 1, cumsum) >= 1) v.1 v.2 v.3 v.4 0.50 0.70 0.80 0.95 Though do note that rowMeans only makes one...

How to calculate rolling Geometric Mean since inception in R

r,xts,mean

Transferred from comments. RET is an xts object and rollapply.xts in the xts package does not support vector widths. Try this to cause it to use rollapply.zoo in the zoo package: rollapplyr(as.zoo(RET), 1:nrow(RET), mean.geometric) ...

Date issues with quantmod getSymbols.csv?

r,xts,zoo,quantmod

This is a bug that has been fixed. Pull the latest from the 'develop' branch on GitHub.

xts to.weekly returns both Fridays and Mondays as the end of the week

r,xts,quantmod,posixct

I agree that the Quantmod data seems fine. It also seems that to.weekly() works with xts objects like GSPC. The problem you're having seems to to be that 1970-01-01 is used as the origin of POSIXct times. To better illustrate this, consider the examples GSPC1970 <- getSymbols("^GSPC", from="1970-12-15", to="1971-03-19", src="yahoo",...

How to select columns name and its value when greater than 0 in R?

r,xts

You could try res <- t(apply(xxx[Sys.Date()-1], 1, function(x) x[x==max(x)])) to get the second format library(reshape2) melt(res) # Var1 Var2 value #1 2015-03-03 HHHHHH 0.33 #2 2015-03-03 IIIIII 0.33 #3 2015-03-03 NNNNNN 0.33 Update You could also do indx <- xxx[Sys.Date()-1]==max(xxx[Sys.Date()-1]) xxx[Sys.Date()-1][,indx] # HHHHHH IIIIII NNNNNN #2015-03-03 0.33 0.33 0.33 melt(as.matrix(...

Count number of ticks in conversion to OHLC

r,time-series,xts,finance

The easiest way is to create a column called Volume. Then to.period will magically do it for you. x <- cbind(myticks_xts$V5, Volume=1) to.period(x, "seconds", 10) # x.Open x.High x.Low x.Close x.Volume #2014-01-01 21:55:34.378 1.376669000 1.376669000 1.376669000 1.376669000 1 #2014-01-01 21:55:47.210 1.376737273 1.376737273 1.376737027 1.376737027 2 #2014-01-01 21:55:57.963 1.376737027 1.376737027 1.376737027...

Merge new row into an existing xts ( purpose: to add current stock quote to historical object from quantmod)

r,xts,quantmod

You just need to create a new xts object from the quote data and rbind it to the historical data. require(quantmod) x <- getSymbols("AAPL", from = "2014-10-27" ,auto.assign=FALSE) q <- getQuote('AAPL') qCols <- c("Open","High","Low","Last","Volume","Last") qx <- xts(q[,qCols], as.Date(q[,"Trade Time"])) y <- rbind(x, qx) tail(y) # AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume...

Filling higher resolution zoo obj with data from lower resolution zoo obj

r,xts,zoo

Try this: z <- cbind(zX, zY = coredata(zY)[match(as.Date(time(zX)), as.Date(time(zY)))]) giving: > head(z, 30) zX zY 2014-12-31 19:00:00 0.20050507 0 2014-12-31 20:00:00 0.98745944 0 2014-12-31 21:00:00 0.02685118 0 2014-12-31 22:00:00 0.82922065 0 2014-12-31 23:00:00 0.77466073 0 2015-01-01 00:00:00 0.87494486 0 2015-01-01 01:00:00 0.39466493 0 2015-01-01 02:00:00 0.49233047 0 2015-01-01 03:00:00 0.19231866...

Idiomatic way to coerce xts object's data attribute to double

r,xts,zoo

You can change the storage mode for GDPMC1 to "double" via: storage.mode(GDPMC1) <- "double" But that won't solve your problem because the issue isn't integer arithmetic. The issue is that xts/zoo align objects by index before performing any Ops methods (arithmetic, logical operations, etc), so your growthRate function will never...

R code to rename header of an xts object using name(object) <- vector

r,xts,quantmod,performanceanalytics

This does not directly answer your question (see the comment), but wouldn't this be easier: library(quantmod) ticker_symbol <- c("zzzz","IVW","JKE","QQQ","SPYG","VUG" ) sDate <- as.Date("2007-09-04") #Start Date eDate <- as.Date("2014-09-02") #End Date get.symbol <- function(ticker) { tryCatch(temp <- Ad(getSymbols(ticker, auto.assign=FALSE, from = sDate, to = eDate, warning = FALSE)), error = function(e)...

How to reverse chronological order with getSymbols in R

r,time-series,xts,quantmod

The final result is the xts object. xts is "fanatic" about order. But you can access the data with function coredata (for data part) and time for time vector. Try for example: res <- data.frame( time = time(close), coredata(close)) res <- res[nrow(res):1,] ...

Generic XTS Endpoints Function

r,xts

The endpoints function has an argument (k) for this: library(xts) data(sample_matrix) x <- as.xts(sample_matrix) endpoints(x, "months") # [1] 0 30 58 89 119 150 180 endpoints(x, "months", k=2) # [1] 0 58 119 180 endpoints(x, "months", k=3) # [1] 0 89 180 ...

xyplot, Error in `[.xts`(y, id) : 'i' or 'j' out of range

r,xts,lattice

The problem is because c doesn't have a dim attribute, like most xts objects do, and how many xts functions expect xts objects to have. Set the dim attribute and everything's okay. dim(c) <- c(length(c),1) xyplot(c~a) ...

I cannot get xts to recognize Time Series in rownames

r,datetime,xts

You are using the xts function incorrectly. The second argument is supposed to be order.by and not by. See the following example with your data: Data: df <- read.table(text=' X7164.JT.Equity 12/27/2000 65.0 12/28/2000 66.5 12/29/2000 66.2') Solution: > xts(df, order.by = as.Date(rownames(df), format = "%m/%d/%Y")) X7164.JT.Equity 2000-12-27 65.0 2000-12-28 66.5...

Obtain date column from xts object

r,xts,quantmod

getSymbols does not return a data.frame by default; it returns an xts object. xts objects do not have row names. They have an index attribute that you can access with the index function.

apply.daily Error: length of 'dimnames' [1] not equal to array extent in R

r,apply,xts

You can split rs by days, apply aggregatets on them and rbind l <- split.xts(rs, f="days") ts <- do.call("rbind", lapply(l, function(x){ aggregatets(x ,on="minutes", k=15)})) ...

How to multiply matching columns between lists?

r,list,matrix-multiplication,xts

Here is a possible solution: mapply(function(X, Y) t(c(X) * t(Y[, colnames(X)])), listab, listcd) Produces: [[1]] AMBV4 ARCZ6 BBAS3 BBDC4 BRAP4 [1,] 0.0105 0.002 0.009 0.009 0.1375 [2,] 0.0330 0.010 0.009 0.012 0.1075 [[2]] ACES4 AMBV4 CMIG3 CMIG4 [1,] 0.010 0.063 0.220 0.007 [2,] 0.024 0.066 0.172 0.022 Here, we use...

Get maximum from xts object using merge function

r,merge,xts,quantmod

Try this: head(merge(HELE, pmax (HELE$HELE.Volume,lag(HELE$HELE.Volume, k=1), na.rm=TRUE))) pmax is the vectorised version of max i.e. it finds the pairwise max between two vectors. You also need to include a na.rm=TRUE otherwise you will end up with NAs where you have missing values. Using only max it would find the global...

R xts loses timezone attribute

r,xts

Development for xts has moved to GitHub. This is bug #2750 and was fixed in revision 790 on R-Forge (issue #10 on GitHub). xts 0.9-8 is scheduled to go to CRAN by the end of this week.

Add date for time series in dygraphs

r,xts,dygraphs

You could do something like this: library(dygraphs) library(xts) #convert the rownames of your data frame to a year-month-day, #used 2012 because it has 366 days and subsetted to fit the example rownames(data)<-strptime(paste0("2012-",1:366),format="%Y-%j")[1:nrow(data)] #transform to xts data<-as.xts(data) #plot dygraph(data) ...

Selecting regular intervals from time series

r,time-series,xts,zoo

Like this? sec <- as.integer(format(index(CO2xts),"%S")) CO2xts[sec > 24 & sec < 57] # [,1] # 2014-12-01 00:00:27 433.6 # 2014-12-01 00:00:30 434.3 # 2014-12-01 00:00:33 434.4 # 2014-12-01 00:00:36 435.4 # 2014-12-01 00:00:39 434.3 # 2014-12-01 00:00:42 434.0 # 2014-12-01 00:00:45 434.1 # 2014-12-01 00:00:48 434.4 # 2014-12-01 00:00:51 434.5...

create lag variable of xts object using $ vs. [] notation

r,xts,nested-lists

You don't need to use [<-.xts. You can use merge instead: for (i in letters) { for (j in variables) { # create all lags mst_ij <- macro.set.ts[[i]][,j] jL <- merge(lag(mst_ij), lag(mst_ij, 2), lag(mst_ij, 4)) colnames(jL) <- paste(j, c("L1","L2","L4"), sep="_") # merge back with original data macro.set.ts[[i]] <- merge(macro.set.ts[[i]], jL)...

R: How to lag xts column by one day of the set

r,xts

If I understand correctly, here's one way to do it: require(xts) # sample data dt <- .POSIXct(seq(1, 86400*4, 3600), tz="UTC")-1 x <- xts(seq_along(dt), dt) # get the last value for each calendar day daily.last <- apply.daily(x, last) # merge the last value of the day with the origianl data set...

Adjusting for Stock Splits in R Error?

r,xts,quantmod,stockquotes

First, these functions were designed to work on daily data, not intraday data. Second, the problem is that Date objects are considered to be at midnight UTC, and your datset object has no timezone. So the adjustment algorithm thinks the split occurred at whatever midnight UTC happens to be in...

Converting data.frame to xts order.by requires an appropriate time-based object

r,error-handling,data.frame,time-series,xts

?xts says that the following about order.by: Currently acceptable classes include: ‘Date’, ‘POSIXct’, ‘timeDate’, as well as ‘yearmon’ and ‘yearqtr’ where the index values remain unique. So an extra explicit conversion is required, e.g. to POSIXct: xts(table[,-1],order.by=as.POSIXct(table$Date)) Open High Low Close Volume Adj.Close 2014-03-31 36.46 36.58 35.73 35.90 15153200 35.90...

Color option in xtsExtra

r,plot,xts,quantstrat

Q1. If you take time to read the help text for plot.xts, you see that the function does not have a col argument. Together with the fact that partial matching of argument names doesn't seem to be allowed in the function, it explains why plot.xts it does not respond col...

Rolling average pairwise correlation - code doesn't work as expected

r,statistics,time-series,correlation,xts

What about using rollapply in different way? As you dont supply the complete dataset, here a demonstration how I mean it: set.seed(123) m <- matrix(rnorm(100), ncol = 10) rollapply(1:nrow(m), 5, function(x) cor.mean(m[x,])) [1] -0.080029692 -0.038168840 -0.058443824 0.005699772 -0.014459878 -0.021569173 As I just figured out, you can also use the function...

Output specific dates

r,xts

It seems that the error is the format string passed to as.Date. It specifies - characters, but you're using / characters in the actual input. The easiest way to do the desired operation, is to use paste on the columns themselves, then pass to as.POSIXlt with an appropriate format string:...

Replacing values in xts object avoiding subscript out of bounds error

r,time-series,xts,zoo

Following works if A consists only of 1s and NAs, as is given in the toy exaple. pmax(pmax(A,lag(A),lag(A,2),na.rm=TRUE), lag(A-A,3), na.rm=TRUE) # A #2014-12-28 1 #2014-12-29 1 #2014-12-30 1 #2014-12-31 0 #2015-01-01 1 #2015-01-02 1 #2015-01-03 1 #2015-01-04 0 #2015-01-05 NA #2015-01-06 1 #2015-01-07 1 ...

How to create a date vector every 6 months using R?

r,date,xts

You could try indx <- seq(as.Date('2000-01-01'), length.out=30, by='6 month') indx2 <- seq(as.Date('2000-06-01'), length.out=30, by='6 month') DATES <- paste(format(indx, '%Y%m'), format(indx2, '%Y%m'), sep="/") DATES # [1] "200001/200006" "200007/200012" "200101/200106" "200107/200112" # [5] "200201/200206" "200207/200212" "200301/200306" "200307/200312" # [9] "200401/200406" "200407/200412" "200501/200506" "200507/200512" # [13] "200601/200606" "200607/200612" "200701/200706" "200707/200712" # [17] "200801/200806"...

Fastest way of finding matching rows

r,data.table,xts

Since you said that speed is your main concern, you can get speedups even over a data.table solution with Rcpp: library(Rcpp) cppFunction( "LogicalVector compareToRow(NumericMatrix x, NumericVector y) { const int nr = x.nrow(); const int nc = x.ncol(); LogicalVector ret(nr, true); for (int j=0; j < nr; ++j) { for...

Create an xts object in R from multiple Quandl codes

r,xts

You don't need to build the xts object - Quandl function does it for you. Example with 2 codes: codes <- c("EOD/VTI.11", "EOD/VEA.11") x1 <- Quandl(codes,type="xts",transformation="rdiff", start_date="2013-12-31",collapse="monthly", force_irregular=TRUE) head(x1) Result: EOD.VTI - Adj_Close EOD.VEA - Adj_Close 2014-01-31 -0.031693078 -0.052063340 2014-02-28 0.048664944 0.059478613 2014-03-31 0.005078150 -0.003653885 2014-04-30 0.000615574 0.015749939 2014-05-31 0.021019174...

'lagging' in irregular time series

r,xts

This is the approach I would take to align the values with the most recent previous observation. It only uses the xts merge function and the na.locf() to fill merged by time values forward: d <- read.table(stringsAsFactors=F, header=T, text=" time bid_price ask_price signal 10:10:01.000500 50.02 50.05 50.03 10:10:01.000855 50.02 50.03...

Convert data frame with epoch timestamps to time-series with milliseconds in R

r,time-series,xts,zoo

Your timestamps are in milliseconds. You need to convert them to seconds to be able to use them with as.POSIXct. And there's no point in calling strptime on a POSIXct vector. Also, it's good practice to explicitly set the timezone, rather than leave it set to "". df$datetime <- as.POSIXct(df$timestamp/1000,...

Decompose xts hourly time series

r,xts,posixct

Why does the timezone for time_index change back to CEST? Because you didn't specify tz= in your call to as.POSIXct. It will only pick up the timezone from the string if it's specified by offset from UTC (e.g. -0800). See ?strptime. R> head(time_index <- as.POSIXct(time_index1, "UTC")) [1] "2012-05-15 12:00:00...

R, lag( ) has inconsistent behavior for xts and ts objects

r,time-series,xts

As was pointed out in the documentation from ?lag.xts, this is the intended behavior.

xts subset quarterly data

r,xts

Looks like a timezone issue. The xts index is always a POSIXct object, even if the index class is something else. Like a Date classed index, the yearqtr (and yearmon) classed index should have the timezone set to "UTC". > a <- as.xts(ts(rnorm(20), start=c(1980,1), freq=4), tzone="UTC") > a["1983"] [,1] 1983...

How do I make R lattice xyplot ignore gaps in time and make a continuous timeseries plot?

r,xts,lattice

If I understand this correctly, what you wish to do is have the weekends not appear in the plot at all. One way to do this is to make another vector which is the order in which you want close plotted - a vector that does not include weekends. Assuming...

Have lapply continue even after encountering an error using getSymbols from quantmod [duplicate]

r,error-handling,xts,lapply,quantmod

You need to put the try block inside your function: quotes <- lapply(tickers, function(x) try(getSymbols(x, ...))) Note we use the simpler try here. If there is an error, your quotes object will contain an object of try-error class at location of element that caused the error....

How to separate a xts data by dates from a list of xts objects and create a list?

r,list,xts

To future reference I used split suggested by JoshuaUlrich to create a quarterly list of data. ibov <- split(ibov, f = 'months', k = 3) It worked fine with split instead of split.xts, producing the same result....

Subsetting xts in R

r,xts

last.xts doesn't seem to work well with a character n if your data aren't regular. Maybe try something like this instead? > trades[paste(end(trades)-60*5, end(trades), sep="/"),] id type price size api 2014-05-10 00:22:52 "37119834" "ASK" "439.645" "0.2730000" "TRUE" 2014-05-10 00:22:52 "37119835" "ASK" "439.643" "0.0380000" "TRUE" 2014-05-10 00:22:52 "37119836" "ASK" "439.642" "3.0852800"...

Why date and time become NA after using `xts`

r,xts

Check the month/day order. 01/01 is valid as day/month or month/day, but 31/03 is only valid as day/month.

R function works on individual column but not with apply

r,matrix,apply,xts

One way to see what's going on is to add print(str(x)) to your last2na function. Or plain replace it with str: str(d[,2]) # An ‘xts’ object on 2014-12-14/2014-12-20 containing: # Data: int [1:7, 1] 8 9 10 11 12 13 NA # Indexed by objects of class: [Date] TZ: UTC...

R: A column is missing after xts data transformation of stock data

r,xts

You can either pass to.period an OHLC object (that optionally has a Volume column), or you can pass it a univariate series (that optionally also has a Volume column). In ?to.period it says that x should be "a univariate or OHLC type time-series object" In the Note section it says...

How to assign value to a date in an xts object in R

r,xts

I think you misunderstand the purpose of the [<-.xts function. You're asking to replace the value at date "2015-05-30" with 1, but your xts object has no data, so there's nothing to replace. What are you actually trying to accomplish? If you want to insert, you should call rbind(xts(1, as.Date('2015-05-30')),...

ts.intersect does not work with xts objects

r,time-series,xts

ts.intersect determines whether the objects is a ts object by looking for the tsp attribute. as.xts.ts removes the tsp attribute, which is why it is not coerced back to a ts object. This looks like a bug in xts->ts->xts conversion, but I need to take a closer look. As a...

Optimizing Signal Parameters with Quantstrat results in error: attempt to select less than one element

r,parallel-processing,xts,quantmod,quantstrat

You need to add the position limit to your portfolio before you call apply.paramset. And you probably want to assign the output of apply.paramset to something. This worked for me using the latest revisions of blotter and quantstrat. addPosLimit(portfolio.st, 'XLF', timestamp=initDate, maxpos=500, minpos=0) ap <- apply.paramset(strategy.st, paramset.label='sigThreshold', portfolio.st=portfolio.st, account.st=account.st, nsamples=0)...

Get most recent index value, which is available in both ZOO objects

r,time-series,xts,zoo

Have transferred this from comment to here and improved slightly. This approach differs from the one posted in the question in the case that there are leading NA values in x or y : start(na.omit(merge(x, y))) ...

rollapply : Is it possible to add end date for each sliding window?

r,time-series,xts,zoo,rollapply

You can make a simple hack by just adding the results of two rollapply-s into a dataframe. #Your code library(zoo) z <- zoo(11:15, as.Date(31:45)) as.data.frame(z) as.data.frame(rollapply(z, width=3, by=2, mean, align="left")) Data for start and end of the reference frame1 <- as.data.frame(rollapply(z, width=3, by=2, mean, align="left")) frame2 <- as.data.frame(rollapply(z, width=3, by=2,...

R: Converting output from getSymbols() to data frame in one command without calling the object name explicitly

r,data.frame,xts,zoo,quantmod

You can try something like this: userInput="EUR/USD" test<-as.data.frame(getSymbols(Symbols = userInput, src = "oanda", from = "2005-01-01",to = "2006-01-01", env = NULL)) Setting the env to NULL results in no creating the data in the environment and returning it. ...

R - Subsetting Dataframe by Column Header and Dates [closed]

r,subset,dataframes,xts

Like this?? set.seed(1) # for reproducible example df <- data.frame(id=rep(LETTERS[1:10],10), date=rep(as.Date("2014-01-01")+0:9,each=10), value1=rnorm(100)) head(df) # id date value1 # 1 A 2014-01-01 -0.6264538 # 2 B 2014-01-01 0.1836433 # 3 C 2014-01-01 -0.8356286 # 4 D 2014-01-01 1.5952808 # 5 E 2014-01-01 0.3295078 # 6 F 2014-01-01 -0.8204684 library(reshape2) result <-...

Calculate average returns for each week of the month over a 10yr period in R

r,date,xts,week-number,quantitative-finance

Try apply.weekly() require(xts) xts.ts <- xts(rnorm(231),as.Date(13514:13744,origin="1970-01-01")) start(xts.ts) end(xts.ts) apply.weekly(xts.ts,mean) It can help aggregate xts data, and automatically knows what "weeks" are....

Lowering the frequency of a time series and holding same hour of the day in despite of summer time R

r,datetime,xts,zoo,posixct

This is what summer/winter time does to regular 4-hour intervals. Try working with a time zone that does not have summer time, like Sys.setenv(TZ="UTC") ...

passing in a variable to be used with write.table

r,csv,xts,quantmod,write.table

Found a workaround! We need to turn the auto assign off in the quantmod function. symbols<-getSymbols(px_ticker,from='1990-01-01', auto.assign=F) ...

Timezone issue when filtering XTS using .indexhour

r,timezone,xts

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