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

Convert tab delimited to XTS within R?

I have tab delimited file in format of: Date Time Last LastSize TotVol Bid Ask TickID BidSize AskSize 8/23/2012 0:00:00 0.95711 1 20670 0.95711 0.95742 0 0 0 8/23/2012 0:00:04 0.9571 1 20671 0.9571 0.9574 0 0 …
heavy rocker dude
  • 2,271
  • 8
  • 33
  • 47
1
vote
1 answer

How to convert an array to xts

library(quantmod) getSymbols('AAPL') n <- nrow(AAPL) a <- runif(n) I would like to convert a to an xts object with dates equal to the dates of AAPL. So far I wasn't able to do it by any way.
1
vote
1 answer

Issues with xts::to.period causing R to crash

I am using xts and am loading 100 to 1000 files in a loop. Each file is between 50k to 300k lines. I am using the latest version of R 2.15.1 on Windows 7 64 bit. I have the same issue on Ubuntu Linux with R version 2.14.X. The code below will…
Dave
  • 2,386
  • 1
  • 20
  • 38
1
vote
1 answer

From-date and first element of sequence in xts::timeBasedSeq

Can some please explain the behaviour below, where, with a from date of "20060301", the first element of the resulting sequence of months is March 2006, but with a from date of "20060401", the start date remains March 2006? >…
Rahul Savani
  • 872
  • 1
  • 10
  • 24
1
vote
1 answer

How does one compute the mean of weekly data by column using R?

I have a data frame of daily data: df with four columns: Date, A, B, C and am trying to get the mean of weekly data by column. I tried: library(xts) xdf <- xts(df[ ,-1],as.Date(df$Date)) apply.weekly(xdf,mean) but this gives me the mean of all the…
adam.888
  • 7,686
  • 17
  • 70
  • 105
1
vote
1 answer

Removing dates with less than Full observations

I have an xts object that covers 169 days of high frequency 5 minute regular observations, but on some of the days there are missing observations, i.e less than 288 data points. How do I remove these so to have only days with full data points? find…
number8
  • 161
  • 8
1
vote
1 answer

r select values below and after a certain value in a dataframe

i have a question how to select certain values from a table. I have a table with times and values and i want to get the row below and after a certain time. Example-Data.Frame. Time Value 02:51 0.08033405 05:30 0.43456738 09:45 0.36052075…
Curlew
  • 1,022
  • 18
  • 39
1
vote
1 answer

split function in xts

I don't understand why split applied to xts gives a list of lists. It should return xts objects. Is there something I am missing? data(sample_matrix) x <- as.xts(sample_matrix) spl<-split(x, f="days") class(spl) [1] "list" class(spl[1]) [1]…
Mitch76
  • 89
  • 1
  • 8
1
vote
0 answers

xts merge memory performance

I am trying to improve the memory performance for the following example: basline df with 4 rows df <- structure(list(sessionid = structure(c(1L, 2L, 3L, 4L), .Label = c("AAA1", "AAA2","AAA3", "AAA4"), class = "factor"), bitrateinbps = c(10000000, …
Sam35
  • 35
  • 7
1
vote
1 answer

R data mining syntax

I am trying to run the code provided with Data Mining With R book. It basically takes the quotes data for SP500 index(GSPC) and builds a prediction function (T.ind) to predict the quotes for next n days. library(DMwR) #load S&P500…
Amey
  • 23
  • 3
0
votes
1 answer

Adding column to xts object based on another xts object in R

I have one main XTS object "Data" with ~1M rows spanning 22 days. I have another XTS object "Set" with 22 rows, with 1 entry per day. I would like to combine this smaller XTS object into the larger one, such that it would have an additional column…
user1266555
  • 3
  • 1
  • 3
0
votes
1 answer

R merge.xts error

I am working with an imported csv file y<- read.csv("y.csv",header=T,sep=",") and I get this error: Error in merge.xts(..., all = all, fill = fill, suffixes = suffixes): 'NA' not allowed in 'index' However I do not have any NA in the data. I have…
adam.888
  • 7,686
  • 17
  • 70
  • 105
0
votes
2 answers

R xts: query both date and time

I can't query xts for subsets including both a date and time range. For example: > head(myxts['2012-01-06 9:30:00/2012-01-06 10:00:00'], 1) Symbol 2012-01-03 09:30:00 "AA" > tail(myxts['2012-01-06 9:30:00/2012-01-06…
Robert Kubrick
  • 8,413
  • 13
  • 59
  • 91
0
votes
1 answer

Creating xts time series

zz <- textConnection("strtimestamp, jstimestamp, 61757, 61754, 61760, 61753, 61758, 61762, 61756, 61759, 61761, 61755, 61752 '01/01/2007 00:00:00', 1167606000000, 1145.3, 1647.3, 612, 963.3, 1063.5, 2294.3, 726.9, 280.8, 5182.4, 739.5,…
Grega Kešpret
  • 11,827
  • 6
  • 39
  • 44
0
votes
1 answer

Read data from Excel to R and convert to xts

I'm trying to load data from excel (from multiple files) into R using the xlsx package und converting the data into a xts object. The data should get as variable names the names of the related .xlsx sheet. The data has in the first column the dates…
rainer
  • 929
  • 2
  • 14
  • 25