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
0
votes
1 answer

Converting xts to data.table in R -issue with the setkeyv argument

I have data in the xts format as follows: EURAUD EURCAD EURCHF 2019-03-05 00:00:00 1.59898 1.50877 1.13258 2019-03-05 00:01:00 1.59893 1.50870 1.13252 2019-03-05 00:02:00 1.59888 1.50888 1.13253 I need a small help in…
Shahal
  • 31
  • 5
0
votes
0 answers

Iterate over R object using SEXP in Rcpp

I'd like to subset an xts object in an Rcpp function and return the subset. If the xts object has an index of class Date extracting the index via Rcpp corrupts the xts object -- see dirk's answer to this question, where he demonstrates that getting…
ricardo
  • 8,195
  • 7
  • 47
  • 69
0
votes
1 answer

How do i use colnames as labels for chart.Correlation like in corrplot

I love the correlation plot from chart.Correlation but for multiple columns the names aren't readable and the values from the single correlation plots aren't that important anymore. So is there a way to define the labels in chart.Correlation to how…
Swyler
  • 124
  • 1
  • 12
0
votes
0 answers

Issue with HighFrequency package in R

I am trying to convert .csvfiles to the xts format using the following code: library(highfrequency) library(timeDate) from="05/03/2018"; to="09/03/2018"; datasource= "C:/Users/Sha/Desktop/SUSU" datadestination=…
Shahal
  • 31
  • 5
0
votes
1 answer

Select a column of an xts to manipulate in R

I have the following headings: "Index","Open","High","Low","Close","Volume" I only want to use the Close volume in the table called prices, how would I only select the column close so I can only use that data? I have tried something along the lines…
eden
  • 43
  • 5
0
votes
1 answer

Attempting to make a new column using the previous value in new column (XTS)

I'm playing with R and xts to create a theoretical scenario where 10k was invested into a stock, and see how it would have grown. I can do everything up to calculating stock returns, but I don't know how to add a new column to an xts that would take…
SNTag
  • 87
  • 8
0
votes
1 answer

Gathering separate data into a single its object in R

I'm trying to use R to measure stock performance. The sample code is from here: https://towardsdatascience.com/how-to-measure-stock-portfolio-performance-using-r-847c992195c2 In the section of code below we're trying to gather separate data into a…
0
votes
0 answers

Better to have OHLC data as Xts or Dataframe?

Very basic question. I have OHLC data as a dataframe object. What is the advantage of having data as an xts object as opposed to a dataframe?
0
votes
1 answer

XTS searching in dates prior to current index

I have an xts with OHLC and a logical column: isSwingBottom. I want a new column that gives the index of first occurrence of isSwingBottom by searching only in dates prior to the current row. I need the closest found row. For example, in this data…
Anupam
  • 81
  • 5
0
votes
1 answer

to.period() does not work properly - trailing milliseconds

I am trying to use to.period to convert milliseconds data into regular seconds level data - however the final output has trailing milliseconds dput(head(x$Mid,20)) structure(c(3228.5, 3228.5, 3228.5, 3229, 3229, 3229, 3229.5, 3229.5, 3229.5, 3229,…
shoonya
  • 292
  • 1
  • 10
0
votes
1 answer

handling calculations with date changes in xts - R

I have a stock dataset in xts format that has data for one year at a minute by minute level. I need to calculate the returns, but only for the periods on the same date. what would be the most efficient way to not calculate the returns while avoiding…
shoonya
  • 292
  • 1
  • 10
0
votes
0 answers

Quantstrat throwing error with my Linear Regression Curve function

I am getting the following error when I run the code below. "Error in if (inherits(sret$indicators, "xts") & nrow(mktdata) == nrow(sret$indicators)) { : argument is of length zero". My guess is I am missing something in my Linear Regression Curve…
0
votes
1 answer

to.period doesn't work combined with xts format

Let's consider following data frame for reproducible example: df <- data.frame( "Date" = c( "2009-11-02", "2009-11-03", "2009-11-04", "2009-11-05", "2009-11-06", "2009-11-09", "2009-11-10", "2009-11-12", "2009-11-13",…
John
  • 1,849
  • 2
  • 13
  • 23
0
votes
2 answers

R: parse python dictionary over json into xts

I create some xts objects, save them as csv files, upload them to google cloud platform,..., create a Python dictionary, download the dictionary and get the results (several original files at once over a REST API) back in R with Rcurl. I want to…
4554888
  • 87
  • 1
  • 11
0
votes
3 answers

Merge arbitrary number of xts objects of different lengths by index

I'd like to merge 3 xts objects of different lengths into one xts with 3 columns and indexed by the first xts object's dates. a_xts <- xts(4:10, Sys.Date()+4:10) b_xts <- xts(c(7:12), Sys.Date()+4:9) c_xts <- xts(15:18, Sys.Date()+4:7) I'd like to…
Rod Purkey
  • 5
  • 1
  • 2