Quantcast
Browsing all 57 articles
Browse latest View live

Aggregate xts coredata in case of duplicate indices

Assuming I have the following xts object with duplicated time information:library(xts)x <- xts(1:5, c("2024-04-19", "2024-04-19", "2024-04-20", "2024-04-21", "2024-04-21") |> as.Date())x#>...

View Article


How Do You Execute If-Then Logic On All The Columns Of An xts object in R

I have an xts object with multiple columns in R and I want to convert all the numbers larger than, say, 0.05 to NA (or -99 or something like that).To get some data to execute on please do the...

View Article


decomposition hourly timeseries

I have the following time series data example: structure(list(cycle_rounded = structure(c(1604534400, 1604538000, 1604541600, 1604545200, 1604548800, 1604552400, 1604556000, 1604559600, 1604563200,...

View Article

as.Date in R completely changes the years

I have a time-series dataset in csv format. The monthly data is from 4/1/1953 to 6/1/2017. I want to convert this into an xts object in R. I used the following codes to import the dataset and then...

View Article

How to handle 'Series contains non-leading NAs' in TTR library with xts objects?

I often run into the same issue of how to handle NA values when modelling quantitative trading models. The example below is about a stock with EOD data since 1997-01-01 stored in a xts object with four...

View Article


Delimit precipitation events from xts objects using `split.zoo`

I'd like to split an xts object of precipitation depths into chunks in order to be able to delimit individual events for subsequent analysis from a continuous record of observations.Let's assume I'm...

View Article

Write ZOO (XTS) object into CSV file by separating index column into two columns

I have 2-column (index and value) ZOO object, where index contains date and time values:2010-02-18 13:11:00 48.090 2010-02-18 13:12:00 48.110 2010-02-18 13:13:00 48.100I want to save this ZOO object...

View Article

junit.framework.AssertionFailedError: Test is stuck, see ANR stack trace for...

I'm running Test cases but facing the below error.junit.framework.AssertionFailedError: Test is stuck, see ANR stacktrace for more info. You may need to create /data/anr firstThe error occurred in the...

View Article


Control the minimal number of required values when aggregating xts objects

When working with e.g. daily air temperature data, I'd like to have better control of how many observations are allowed to be missing in order to not calculate the monthly average (or whatever...

View Article


multiple columns in a sliding window, runner package, xts format

I'm trying to do something similar to w1, which contains colums in a sliding window of size kset.seed(1)library(xts)tm <- Sys.time()+1:5000x <- rnorm(5000) |> cumsum() |> round(1) |>...

View Article

Dygraph multiple plots - turn them on and off with R and dySeries options

Good afternoon everyone,I am discovering dyGraph for R and it is an amazing tool.I need to plot only two variables ("Lifetime.Engaged.Users"& "Lifetime.Post.Total.Reach") of my 32 variables xts...

View Article

how sort in reverse order xts object

I'm trying to do a regular reverse sort, but I don't understand how to do it with an xts object. I want the last date to be in the first line and not the last.I tried several ways but it doesn't...

View Article

Is indexAt="lastof" no longer valid for xts::to.weekly?

simple reproducible example:set.seed(1234)len <- 1000fake <- zoo::zoo(rnorm(len, mean = 0.001, sd = 0.0005), order.by = seq.Date(from = as.Date("2000-01-01", tz = "UTC"), length.out = len, by =...

View Article


Image may be NSFW.
Clik here to view.

Forecasting time series data

I've done some research and I am stuck in finding the solution. I have a time series data, very basic data frame, let's call it x:Date Used11/1/2011 58711/2/2011 57811/3/2011 60011/4/2011 59911/5/2011...

View Article

Obtaining last Friday's date

I can get today's date:Sys.Date( )But how do I get last Friday's date?I tried:library(xts)date1 <- Sys.Date( ) to.weekly(date1 )But this gives an error.

View Article


Get the specific index of occurence when working with period.apply

Assuming I worked with meteorological observations and wanted to know not only the daily maximum value but also the relevant timestamp, describing when this value was observed, is it possible to...

View Article

Plotting an xts object using ggplot2

I'm wanting to plot an xts object using ggplot2 but getting an error. Here is what I'm doing: dates <- c("2014-10-01", "2014-11-01", "2014-12-01", "2015-01-01", "2015-02-01")value <-...

View Article

Browsing all 57 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>