Questions tagged [xts]

xts is an R package that contains an eXtensible Time Series class and methods. xts extends and behaves like zoo.

xts is an package for analysis. It provides uniform handling of R's different time-based data classes by extending the package.

Repositories

Vignettes

Other resources

Related tags

1987 questions
1
vote
2 answers

Rolling frequency of irreqular tick-data xts timeseries

My problem is having to do with counting the frequency of an irregular timeseries containing tick-data. The problem starts where Joshua's excellent tips end here:…
nikke
  • 111
  • 8
1
vote
2 answers

Is it possible to plot a single second period in xts (sub-second series)?

I get an error "Error in if (on == "years") { (from #17) : missing value where TRUE/FALSE needed" when trying to plot sub-second series in xts. That is, my xts object only includes observations for the same second: …
Robert Kubrick
  • 8,413
  • 13
  • 59
  • 91
1
vote
2 answers

How can I query an xts time range using indexes rather than string

I can query an xts time range by using two time strings separated by "/": library(xts) set.seed(1234) a = xts(1:10, as.POSIXlt(1366039619, tz="", origin="1970-01-01") + rnorm(10, 0, 3)) [,1] 2013-04-15 11:26:51.962906 …
Robert Kubrick
  • 8,413
  • 13
  • 59
  • 91
1
vote
1 answer

Cut data by date for multiples of break="min"

I'm using R to aggregate tick data and I have the following function which works well to aggregate the data to the minute but now I want to expound on that and aggregate to 5, 10, 15min. How can I do that? SPY <- aggregate(as.numeric(SPY$PRICE),…
postelrich
  • 3,274
  • 5
  • 38
  • 65
1
vote
3 answers

Convert a data frame with many time series into a list of single variate xts

I have a data frame of time series: X1.HK.Equity X X2.HK.Equity X.2 X3.HK.Equity X.4 1 31/12/2002 38.855 31/12/2002 19.547 31/12/2002 5.011 2 02/01/2003 38.664 02/01/2003 19.547 02/01/2003 4.986 3 03/01/2003 40.386 …
mchangun
  • 9,814
  • 18
  • 71
  • 101
1
vote
1 answer

Matching numeric patterns in nearby time periods

I would like to use R in combination with quantmod to generate trading signals based on candlestick chart patterns. My plan is to write a user defined function which calculates a signal per time period based on OHLC data. What I have so far…
styx
  • 421
  • 8
  • 15
1
vote
1 answer

Subset xts object using vector of unique index days

I'm trying to subset an xts object using a vector of xts timestamps that have been processed into a vector of unique timestamps. This follows on from this previous question that was only partially answered. Some sample data: dput(sample.data.merge,…
Rothsom
  • 53
  • 7
1
vote
1 answer

Apply rolling function to list of xts objects

This is similar to several other questions, but I've still not managed to get it to work. I'm trying to apply a rolling function (runMAD from the TTR package) to a series of financial info (trading price and volume), but the rolling operation should…
Rothsom
  • 53
  • 7
1
vote
0 answers

STIDF time interval

I m trying to convert a spatial point data into STI c2168.st <- STIDF(sp, time = c2168$date, data = c2168[,c("id","date")]) Warning message: In STI(sp, time) : STI(): setting timeIsInterval to default value FALSE. How should I set it ? I used…
1
vote
2 answers

apply to an xts object in R

I have an xts object. I would like to take an average for each row and merge it back to my object. Ex: require(xts) obj = xts(matrix(1:100, ncol=2), order.by=seq.Date(from=as.Date("2012-01-01"), by=1, length=50)) another_obj = apply(obj, 1,…
Alex
  • 19,533
  • 37
  • 126
  • 195
1
vote
3 answers

Convert intraday time series to daily

I have been using to.daily from the xts package to achieve this, but since upgrading R have encountered a known bug in this function, so would like to find an alternative way. I would like to use functions from Base R if possible. It looks like I…
1
vote
1 answer

Can't index xts class with Date type

I'm loading some data manually (vs. via quantmod) and trying to create an xts class (which all seems to work ok), but I can't seem to use Date type indexes. I am trying to find the intersection with another time series (NDX, via quantmod), which…
dizzy
  • 381
  • 1
  • 2
  • 10
1
vote
1 answer

How to convert the following data into zoo/xts/tseries object to calculate maximum drawdown?

How to convert the following data into zoo/xts/tseries object to calculate maximum drawdown by using the function Return.calculate and Maxdrawdown function? Hello friends i have equity(eg CENTURYTEX,AAPL,RIL etc) specific eod prices for around…
1
vote
1 answer

applying min/max on lagged series of xts/zoo object

The max of the Close column is valid, but why is the max of the lagged Close NA? > library(quantmod) > s <- get(getSymbols('nvmi')) > max(Cl(s)) [1] 11.48 > max(Lag(Cl(s))) [1] NA > max(as.numeric(Lag(Cl(s)))) [1] NA
haki
  • 9,389
  • 15
  • 62
  • 110
1
vote
1 answer

Global silent assignments from within a data.table

I am working with several time series and their characteristic in a data.table in long format and I would like to construct several different types of xts object exploiting the data.table syntax. Here is what I have in mind: Some preliminary…
Ryogi
  • 5,497
  • 5
  • 26
  • 46