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

Is there a way to split an xts time series object at a particular point of time

I am trying to split a time series data of oil prices spanning 35 years at particular year. For example, all data up to 2018 into one series and later data into another. Can I use the split() function to do the same? More details about the time…
0
votes
1 answer

R: how to format data before applying cross-correlation

I want to do a cross correlation on two time series data sets. The data sets looks as below. > head(link420) time diff420 1: 2018-01-01 08:00:00 18.50 2: 2018-01-01 08:05:00 0.00 3: 2018-01-01 08:10:00 -4.25 4: 2018-01-01…
Yun Hyunsoo
  • 71
  • 1
  • 8
0
votes
1 answer

How to calculate the historical monthly volatility from daily returns in R?

First I created an xts object, which contains 36 time series showing daily prices from 1980-01-02 to 2020-10-06. ENERGY_data$time <- as.Date(ENERGY_data$time, format("%Y/%m/%d")) ENERGY_xts <- ENERGY_data[order(ENERGY_data$time), ] ENERGY_xts <-…
Flash7
  • 1
  • 2
0
votes
2 answers

Convert range of dates in narrative form to .xts dates

I have a character string "April 20, 2020 - April 24, 2020" and would like to convert it to two separate strings. There are two problems here: (1) recognizing that the narrative "April" is the 4th month, and (2) that there are two different dates…
W Barker
  • 324
  • 2
  • 8
0
votes
1 answer

lag.xts issue: Error in lag.xts(x, n, na.pad = na.pad) : abs(k) must be less than nrow(x)

Description Encountering an error running RMD script: Error in lag.xts(x, n, na.pad = na.pad) : abs(k) must be less than nrow(x) In the # Get weights function below Expected behavior Script is calculating weights. Below is the current codeblock and…
AM H
  • 1
0
votes
1 answer

Removing rows from an xts object if they fall within a time range

I'm using r to analyse some stock price data, and currently have an xts object containing price at 1 minute intervals spanning multiple days. However, this xts object also contains prices outside of trading hours (8:30-16:30 in this case), and I'd…
dslater0
  • 57
  • 6
0
votes
1 answer

xts plot not showing up in new device/window

Following data can be either a tibble or data.table: datetime volume 2020-08-25 09:30:00.000 0 2020-08-25 09:30:12.000 107 2020-08-25 09:30:50.000 221 2020-08-25 09:30:50.000 …
stucash
  • 1,078
  • 1
  • 12
  • 23
0
votes
0 answers

lapply to convert list of dataframes to xts objects - subscript out of bounds error

I have a list of 31 data frames (split_data_V3.0) that I am trying to convert to xts object using lapply. The code gets executed but when I try to open the elements from the new lists (split_data_V3.0_zoo, split_data_V3.0_xts) I get the error…
0
votes
1 answer

Conversion of weekly - string format data to weekly(7 day week) xts data frame

I have a csv. file containing a prices series of a commodity from 1997 to 2018, in weekly - string format and it has exactly 52 observations per year. Which means, a week is defined as a seven day week. I want to convert this to a new data frame of…
Jayamini
  • 31
  • 2
0
votes
1 answer

R dygraphs - plot certain content of columns

I have a csv file "fruit.csv" looking like that: "Date","Fruit","Count" 2019-01-01,Apple,3 2019-01-01,Pear,5 2019-01-01,Banana,4 2019-02-01,Apple,4 2019-02-01,Pear,4 2019-02-01,Banana,6 ... I want to plot the data having the date in the x-axis and…
user13963485
0
votes
1 answer

Sliding window on date-time field in data frame R

I want to calculate a some descriptive statistics: by specific customer (in example, customer_id field) for a sliding time window (in example, 24h) excluding the current value (using only previous values in period) Example of a data frame: dt <-…
codez0mb1e
  • 706
  • 6
  • 17
0
votes
1 answer

Modifications in Performance Analytics charts

I am visualising various financial series in R. I am using Performance Analytics package in R for this. Is there any way to do modifications in charts created by this package like changing the title of the chart, axis titles…
sim235
  • 219
  • 1
  • 9
0
votes
1 answer

I want to forecast data but am unable to find a method to convert an xts format to a timeseries to do so?

the data i have is separated by three days each, i have successfully converted the dates so that i can convert it to an xts format but most forecast functions are unavailable on it, hence i need to convert to a time series. > my.dates <-…
0
votes
1 answer

#R #Non-numeric argument for binary operator #xts object * integer

I have an xts object. Thus a time series of "outstanding share" of a company that are ordered by date. I want to multiply the time series of "outstanding shares" by the factor 7 in order to account for a stock split. > outstanding_shares_xts <-…
0
votes
1 answer

How to apply a t-test for a whole table with NAs in R

my table kinda looks like this: date factor1 factor2 factor3 1973-01-31 3.112309 1.011383 NA 1973-02-28 2.120466 11.021701 NA 1973-03-31 1.125156 0.030822 1.011383 1973-04-30 11.135342 1.067682 …