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

Window.xts in parallel

Why does window.xts not work in parLapply? The below code gives me error: "Error in checkForRemoteErrors(val) : 8 nodes produced errors; first error: invalid time / time based class" library(parallel) z <- xts(11:15, as.Date(31:35)) testfun <-…
Tomta678
  • 16
  • 2
0
votes
1 answer

Finding the maximum in an xts column within the last X hrs

I have a dataset within a reactive dygraph that looks like this: data()$data.o date data.o 2022-07-21 12:10 AM 400.1 2022-07-21 12:11 AM 33.9 2022-07-21 12:12 AM 32.5 2022-07-21 12:13 AM 35.1 2022-07-21 12:14 AM 31.5 2022-07-21…
Kyle
  • 403
  • 4
  • 15
0
votes
1 answer

Did quandl end cme data on June 30th 2022?

library(Quandl) library(xts) Quandl.api_key("your_api_key") cl <- Quandl("CME/CLU2022", type = "xts") This data ends on June 30th 2022. As of today 7/14/2022, it should have data out to 7/13/2022. Thank you!
Joe
  • 349
  • 1
  • 2
  • 11
0
votes
0 answers

How to transpose a xts Matrix? xts(); as.xts()

how can I transpose a xts Matrix? I do this before M<-Z d <- as.Date(1:nrow(M)) M<- xts(M, order.by=d) class(M) [1] "xts" "zoo" # Matrix M has size 700x70 as xts format. Everything ok! But I need these Matrix transponed as 70 x 700 format. How…
0
votes
1 answer

Join a xts object and a data frame by date, one day forward, in R

I have the following xts object and data frame in R. xts: data frame: I need to join them by date, the date in the xts object being one workday forward the date in the data frame, for each record that needs to be matched. So I would need to find…
SuavestArt
  • 193
  • 1
  • 6
0
votes
1 answer

XTS in R studio

I'm reading a binary output file of a program using a R package. When I executed the below line of code I see a data structure as shown in the snapshot under the 'Environment' tab of R Studio. output <- read_out("test.out", iType = 0, object_name =…
0
votes
2 answers

R - Number of observations per month in an xts object (weekday data)

I have several xts-objects containing weekday data from 2001-01-01 to 2021-12-31. Now I need to know the number of observations within each month from January 2001 to December 2021 in order to further analyse them. How can I get these? I'm rather…
Lennart
  • 15
  • 4
0
votes
1 answer

R: Converting daily timeseries data to monthly

I am trying to find the deltacovar using the systemicR package but I am having trouble reading my csv file properly in xts form for my daily time series data and converting them into monthly data. I am getting the below mentioned error. How do I fix…
0
votes
1 answer

maxDrawdown function from Performance Analytics giving incorrect values

I call the maxDrawdown function of the package PerformanceAnalytics on a column of daily returns. when I calculate the cumulative returns of the column and I make a plot, it looks like this. When I calculate the max of the cumulative returns, I find…
0
votes
1 answer

How to create and merge multiple xts objects

I want to merge MANY xts objects in a loop. In order to do so, i have to write the following code 138 times. temp=merge(temp,temp1) temp=merge(temp,temp2) temp=merge(temp,temp3) temp=merge(temp,temp4) is there a way to automate that procedure?
0
votes
1 answer

Counting observations per month in a data frame

I currently have a dataframe that has two columns: arrest date and number of arrests. The date column has almost every single day from 2006-2020; instead of having the number of arrests per day, I'd like to have the number of arrests per month, per…
amatof
  • 175
  • 1
  • 13
0
votes
1 answer

Why I am having troubles with the pipe operator?

I have been using this code multiple times, it worked two weeks ago as usual, but now, when I run the first line, R does not change the dataset I don't know why. As soon as I remove the pipe operator the dataset changes but I can't filter by…
0
votes
1 answer

Convert tibble to xts for analysis with performanceanalytics package

I have a tibble with a date and return column, that looks as follows: > head(return_series) # A tibble: 6 x 2 date return 1 2002-01 0.0292 2 2002-02 0.0439 3 2002-03 0.0240 4 2002-04 0.00585 5 2002-05 -0.0169 6…
Ramon
  • 71
  • 8
0
votes
1 answer

Error in xts: 'order.by' cannot contain 'NA', 'NaN', or 'Inf'

I download time-series data from MSCI: MSCI-daily. I found that the dates are not properly formatted, so I need to deal with it. I use this code to dealing with data-time: daily$Date <- daily$Date %>% as.Date(format = "%b %d, %Y") for(i in 2:7){ …
0
votes
1 answer

R tibble dataframe slice and rollapply function

I am writing a script to calculate the standard deviation of S&P500 and want to compare the rolling standard deviation to the long term average of the SD. I can make my codes work but seems kind of clumsy. I want to ask two questions to make my code…