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

R: aggregating time series groups of irregular length

I think this is a split-apply-combine problem, but with a time series twist. My data consists of irregular counts and I need to perform some summary statistics on each group of counts. Here's a snapshot of the data: And here's it is for your…
jonnie
  • 745
  • 1
  • 13
  • 22
1
vote
1 answer

xts - last obervation in a period

I know that this must be an easy task but I got stucked and cannot move forward. I have the following xts: timestamp id type price size api 2014-05-02 00:02:07 "1398981727" "36833484" "BID" "449.247"…
Steef Gregor
  • 544
  • 1
  • 7
  • 21
1
vote
1 answer

plotting High Frequency finance data using quantmod

Hi I have data in xts format like this > ITXxts Time Price Volume 2014-07-18 09:00:00 67.63 460 2012-04-27 09:00:00 67.63 73 2012-04-27 09:00:00 67.63 85 2012-04-27 09:00:01 67.63 3 2012-04-27…
Panchacookie
  • 427
  • 1
  • 6
  • 22
1
vote
1 answer

Split data frame into multiple data frames based on information in a xts object

I really need your help on the following issue: I have two data frames - one containing a portfolio of securities with ISIN and Cluster information. > dfInput TICKER CLUSTER SECURITY.NAME 1 …
Daniel_D
  • 698
  • 1
  • 7
  • 13
1
vote
1 answer

Odd behavior with vector assignments to xts object: reverse from expected

I want to do a vector assignment of specific dates that happen to be in the reverse order of the xts's index like so: # create xts index and an all-zeroes instance of xts idx <- seq.Date( as.Date("2011-01-01"), as.Date("2011-10-01"), by='month' ) x…
Matthew Turner
  • 3,564
  • 2
  • 20
  • 21
1
vote
1 answer

subset list of xts objects

There's a great post on here that has clear examples of subsetting an xts object: Return data subset time frames within another timeframes? However, I have list of xts objects and I am looking to subset each component of this list by gathering all…
jonnie
  • 745
  • 1
  • 13
  • 22
1
vote
1 answer

chartSeries with XTS, can't plot points and technical indicators simultaneously

Edit: I rigged a smaller example so you can reproduce it if you want. I have a OHLC XTS table I'm using (of Euro/$) > theBars Open High Low Close 2014-06-17 01:42:26 13835 13836 13835 13836 2014-06-17 01:42:59 13836 13838…
hedgedandlevered
  • 2,314
  • 2
  • 25
  • 54
1
vote
1 answer

cbind or merge by pasting names?

I have many large xts objects in my workspace that i am trying to combine by using cbind , merge, apply or even in a loop. Currently, the xts data is tick data and cannot paste it here because of its length. However, what I am trying to do…
Rime
  • 912
  • 2
  • 11
  • 39
1
vote
2 answers

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

I did a regression on a time series data in xts format > inputfit <- lm(y_t ~ y_tminus1 + cpi_t + cpi_tminus1 + m1_t + m1_tminus1 + ip_t + ip_tminus1, data = RegData) >…
user3212376
  • 237
  • 1
  • 4
  • 12
1
vote
1 answer

R - Extracting summary statistics for all columns in an xts object either directly or first converting to data frame

I have an xts object that includes multiple parameters over a 24 hour period (measurements each minute). Based on the time, I have added a column grouping into 4 'time of day' (tod) options: 'morning', 'afternoon', 'evening' and 'night'. I would…
1
vote
1 answer

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

I am trying to scatter plot two variables, one of which is the residuals from an lm() call. The xyplot() function will not do this scatter plot and returns the error message Error in `[.xts`(y, id) : 'i' or 'j' out of range The residuals are an xts…
moof
  • 189
  • 9
1
vote
1 answer

Remove incomplete month from monthly return calculation

I have some code for grabbing stock prices and calculating monthly returns. I would like to drop the last return if the price used to calculate it did not occur at month end. For example, running the code below returns prices through 2014-06-13.…
tragen907
  • 23
  • 3
1
vote
0 answers

R - Changing XTS Periodicity Subsetted By Variable

I currently have an xts with a character string column called "Symbol" and then several columns of numerical and character data. The data is mostly weekly and also at the end of the month. I would like to aggregate this data to a monthly periodicity…
user2844947
  • 75
  • 1
  • 9
1
vote
2 answers

Filter xts objects by common dates

I am stuck with the following code. For reference the code it is taken from the following website (http://gekkoquant.com/2013/01/21/statistical-arbitrage-trading-a-cointegrated-pair/), I am also compiling the code through R…
NodeExplosion
  • 83
  • 1
  • 6
1
vote
1 answer

How to apply xts function per row in a dataframe

I have a dataframe in R, and a column called created_at which holds a text which I want to parse into a datetime. Here is a snappy preview: head(pushes) created_at repo.url repository.url 1 2013-06-17T00:14:04Z…
oski86
  • 855
  • 1
  • 13
  • 35