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
2 answers

How to loop through a time series in R and identify a specific pattern?

I've imported price data for the S&P500 for the last 20 years and created a separate XTS containing only the close price for each day. I now need to create a loop that goes through the data and records every time the price has declined for three…
Avivi
  • 1
0
votes
1 answer

How can I interpolate my time series to have the same size (for clustering purpose)?

I have a list (df_list) of 40 time series (class "xts" "zoo") with different lengths and would like to interpolate them against the time series with the longest length to obtain time series of the same length. Time series begin and end on different…
LZL
  • 91
  • 5
0
votes
1 answer

R how to convert the data.frame into time series one by one

I have a series of data.frame like r t 1 x 2 2 y 3 3 z 4 but I want to convert these three into time series, like q = xts(as.matrix(data[1,]), order.by = "2011-09-28") qq = xts(as.matrix(data[2,]), order.by = "2011-09-28") qqq =…
Eva
  • 917
  • 4
  • 18
  • 23
0
votes
0 answers

Transform data frame to XTS object changes all numeric columns to character

I have a large dataframe (6,300 columns * 5,480 rows) of daily prices of stocks. The data frame looks like this: All the columns are marked numeric in the data frame (except the first one "Date", this is unknown). When I transform the data frame…
Li4991
  • 59
  • 5
0
votes
0 answers

Calculating forward returns of an XTS object

I have a standard XTS stock price object. I would like to add a column that consists of the forward one year return. So, if the row I’m evaluating is 2019-03-01, I would like the return of 2019-03-01 to 2020-03-01 to be added. I have experimented…
Kevin Muir
  • 21
  • 3
0
votes
2 answers

Blotter R used with XTS package

Hi all has anyone noticed that since the last update on 15 Sep blotter R package is not possible to download anymore from the Forge. Is this a glitch or the whole package has been taken down and is not anymore part of open source?
mat
  • 1
0
votes
3 answers

How to return the date associated with each member of a sorted list in xts

I have an xts object 'foo' containing the top 6 largest negative percentage changes in the value of the share price of a stock over a certain period. Using sort(foo) produces a list sorted by date, as shown below, but I want to sort the list based…
SlowLearner
  • 7,907
  • 11
  • 49
  • 80
0
votes
1 answer

Combine multiple xts-objects into a array with considering of the columns

Hi guys i'm wondering if there is a possibility to add multiple xts-objects into a 3-D-Array. I want to put multiple Stock-Data from quantmod together in an (n x m x 4) array. the 4 is for respective close, open, high, low price of the stocks. So at…
nino123
  • 11
  • 2
0
votes
0 answers

Can I terminate the output of the lag() function in R at a set date? OR: How to get same results for lag.xts() and lag() :)

I used lag.xts() to create lags of my ts objects. However, I am now trying to keep everyhting base R and replacing that with lag(). So same output needed with different function. I found out that in lag() the parameter k generates leading data if…
mohid
  • 1
  • 1
0
votes
2 answers

reading daily time series data in R using xts, error message

Dear Stackoverflow community, I have been trying to read these set of daily stock market data using xts object and been getting different types of error messages, listed below. The dataset contains 5030 observations, from 4/01/2000-22/07/2019. I…
0
votes
1 answer

How can I exclude file rows that are non numerical for use by XTS in R?

I have a reactive dataframe that reads a file that updates with new data. Occasionally the data in the file will have error messages or other non numeric lines and will break the order.by XTS…
Kyle
  • 403
  • 4
  • 15
0
votes
0 answers

subscript out of bounds error when using ifelse function in R

I am trying to get a signal using ifelse in R, but , when comparing two xts objects, I get a subscript out of bounds error, even though they have the same number of rows and columns, and don't contain any NAs. The code is as follows: Max_cl…
0
votes
0 answers

Error in tk_xts(.) : could not find function "tk_xts" - Error when trying to convert a dataframe of stock returns into a time series object

I have a dataset of five stocks and their returns that I'm trying to modify the dataset and eventually create a covariance matrix. I've been trying the function below to convert the dataset into a time series object using the "xts"…
hsso
  • 1
  • 1
0
votes
0 answers

R xts issue in calculating drawdown for several variables

When I try to calculate table.Drawdowns (PerformanceAnalytics package) for one asset, all works fine. But I struggle to use a larger dataset with more than one asset. First, this code works fine for one asset. The csv contains a date column followed…
Peter
  • 31
  • 3
0
votes
1 answer

R/zoo: duplicate index entries in ‘order.by’ are not unique

I have an excel file containing 3 columns of data against a column of time at one hour interval. I tried to convert the data into a zoo object. But everytime i tried to that there is an error that says "In zoo(y, order.by = index(x), ...) : some…