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

convert several list objects in a matrix to an actual list

I extracted daily temperature data over a time span of 45 years. I used all possibilities I could think of to append, cbind, rbind those data into a variable that grows every year loop. Besides the value I also included the time (as.Date). My final…
Eric
  • 137
  • 2
  • 8
0
votes
1 answer

does lubridate work with apply.daily

I am trying to understand from this example if lubridate can be applied to apply.daily but don't quite understand how to do that. can I get any reference to using lubridate with apply.daily so I can exclude weekends using apply.daily Stackoverflow:…
user1155299
  • 877
  • 5
  • 20
  • 29
0
votes
1 answer

Why such large differences in performance between R's by() and lapply()?

I have an xts object containing time series for multiple stock symbols. I need to split the xts object in symbol-specific subgroups and process the data for each symbol, then reassemble all the subgroups in the original xts matrix containing the…
Robert Kubrick
  • 8,413
  • 13
  • 59
  • 91
0
votes
3 answers

Getting data from minute xts objects at particular minute

I am trying to get out a specific row (at a particular minute in a day) of a minute xts data. I have tried several things but only one strange thing works. > last(UpRatio["T10:14:00/T10:15:00"]) TICK.NYSE.Close 2011-12-23 10:15:00 …
Samo
  • 2,065
  • 20
  • 41
0
votes
1 answer

R format answer to time difference

I'm trying to format the answer from subtracting 2 times. Here's an example: > timer2$tdif2 <- as.numeric(strptime(as.character(timer2$time3), "%H:%M:%S:%OS") - strptime(as.character(timer2$time2), "%H:%M:%S:%OS")) > timer2$tdif1 <-…
screechOwl
  • 27,310
  • 61
  • 158
  • 267
0
votes
1 answer

divide a matrix by one column

I have a multicolumn xts that I would like to divide by one xts (using the date as primary key, of course). Is there a way to do that in a vectorized manner? Thanks
RockScience
  • 17,932
  • 26
  • 89
  • 125
0
votes
0 answers

Calculate Return with R

I'm a new to R. I have an Excel file called "bitcoin" which contains two columns: "date" and "BTC.Close". I've imported the data into R and transformed it into an xts object. However, I'm encountering an issue when attempting to compute returns…
ines
  • 1
  • 2
0
votes
2 answers

Period apply after filtering missing data

I have a large xts of 10 minute data that I am trying to average hourly. The data also has some missing data within it. I want to average all of the hours that have >50% data completeness but replace all hours that have <50% data completeness with…
johnnyg
  • 129
  • 8
0
votes
1 answer

Matching R time series class between input and output

I have an R function that analyzes regular time series, originally written by assuming the data were just a vector, say of length N. It outputs a list of vectors that are either of length N or length N+1 adding a t=0 result. So here is a conceptual…
Eli S
  • 1,379
  • 4
  • 14
  • 35
0
votes
1 answer

Cannot Create xts Object from Data.Frame that has Properly Formatted Date Index

frame that should be properly formatting with a date index that's properly formatted to be an .xts. However, I cannot complete the conversion to an xts object and receive the following error: Error in xts(master_zillow5) : order.by requires an…
js80
  • 385
  • 2
  • 11
0
votes
1 answer

How to split xts OHLC data by the specified number of candles

I have candle data len <- 10000 times <- seq(as.POSIXct("2016-01-01 00:00:00"), length = len, by = "sec") prices <- cumsum(rnorm(len))+1000 library(xts) xp <- xts(x = prices,order.by = times) xp <- to.minutes5(xp) xp xp.Open xp.High xp.Low…
mr.T
  • 181
  • 2
  • 13
0
votes
1 answer

Take every Xth value of an xts object

I've got an xts object that contains data in a temporal resolution of seconds. For instance: times <- seq.POSIXt(from=as.POSIXct("2023-04-01 00:00:00"), to=as.POSIXct("2023-04-04 00:01:00"), by = "sec") xdata <- runif(n=length(times)) series <-…
smoff
  • 592
  • 5
  • 21
0
votes
1 answer

can't draw "chart_Series" graph in loop "quantmod package"

I just installed the latest version of R and installed the latest version of Rstudio and ran into an interesting problem. It turned out that I can draw one graph library(quantmod) library(xts) getSymbols('AAPL',src='yahoo') AAPL <-…
mr.T
  • 181
  • 2
  • 13
0
votes
0 answers

How can I split an xts object into chunks of similar size, but continuously not randomly?

I did this but split the series into random chunks: chunks <- split(GC, f = 1:3) I need continuous chunks, taking into account the date that is in the index.
0
votes
3 answers

Aggregating by multiple variables including time

I'm new to programming in R (and for that matter, programming at all...) and I'm trying to do some data analysis for a project for my class. I have some data that looks like this: Id Time Heartrate 1341231 2016-04-12…