similar to: xts conversion problem

Displaying 20 results from an estimated 5000 matches similar to: "xts conversion problem"

2011 Jul 30
1
Plot.xts - how to change the x-axis labels to show weekly labels.
Dear R-users I am new to R and struggling not to bother the list with silly questions. I read the documentation on xts and searched for some examples over the internet on how to use plot.xts. The xts object is as follows dataxts : An 'xts' object from 2010-06-27 to 2010-08-05 containing: Data: num [1:56161, 1:14] 74 74.2 74.2 74.1 73.9 ... Indexed by objects of
2012 Apr 27
1
multivariate xts merge question
Hi, I have an xts starting with a number of columns (currency pairs see below), then I add new ones which are derived from existing ones (like adding the moving average of a column) by merging the new columns one by one. These get the name of the column they are calculated from concatenated with ".1". All done by merge.xts, easy. Now, I have a function (procState below) which generates
2011 Oct 03
1
xts/time-series and plot questions...
Hello, I'm a complete newbie to R. Spent this past weekend reading The Art of R Programming, The R Cookbook, the language spec, Wikis and FAQs. I sort-of have my head around R; the dizzying selection of libraries, packages, etc? Not really. I've probably missed or failed to understand something... I have very a simple data set. Two years (ish) of temperature data, collected and
2011 Mar 07
1
Associating the day of week to a daily xts object
I have the following xts objetct "temp" > str(temp) An ?xts? object from 2010-12-26 to 2011-03-05 containing: Data: num [1:70, 1] 2.95 0.852 -0.139 1.347 2.485 ... - attr(*, "dimnames")=List of 2 ..$ : NULL ..$ : chr "t_n" Indexed by objects of class: [POSIXct,POSIXt] TZ: GMT xts Attributes: NULL > temp t_n 2010-12-26
2011 Jan 11
1
Interpolate xts
Hello, I have a xts object, I would like to fill the NA with linear interpolated data. Can anyone please help. > str(zz) An ‘xts’ object from 2010-11-24 15:59:29 to 2010-11-24 16:00:00 containing: Data: num [1:23401, 1] 312 312 312 312 312 ... Indexed by objects of class: [POSIXct,POSIXt] TZ: xts Attributes: List of 2 $ src : chr "datafeed" $ updated: POSIXct[1:1],
2010 Apr 08
2
xts off by one confusion or error
Hullo I may have missed something blindingly obvious here. I'm using xts to handle some timeseries data. I've got daily measurements for 100 years. If I try to reduce the error rate by taking means of each month, I'm getting what at first sight appears to be conflicting information. Here's a small subset to show the problem: A small set of data: > vv x
2016 Apr 18
0
Add a vertical arrow to a time series graph using ggplot and xts
Hi, I am trying to add a vertical arrow (from top to bottom or from bottom to up) to a time series plot using ggplot2 and xts. It seems that the vertical line command "geom_vline" does not work for this purpose (Correct me if I am wrong). I try the command "geom_segment" as follows, but I got an error message at the last line "Error: Invalid input: date_trans works
2016 Apr 20
0
Add a vertical arrow to a time series graph using ggplot and xts
Please see updates to df2 assignment as shown below. library(xts) # primary #library(tseries) # Unit root tests library(ggplot2) library(vars) library(grid) dt_xts<-xts(x = 1:10, order.by = seq(as.Date("2016-01-01"), as.Date("2016-01-10"), by = "1 day")) colnames(dt_xts)<-"gdp" xmin<-min(index(dt_xts))
2010 Nov 05
1
as.xts
hey I am trying to turn a dataframe into xts with the function: as.xts, but it returns the error: Error in as.POSIXlt.character(x, tz, ...) : character string is not in a standard unambiguous format could someone give me some pointers please the data is coming from a spreadsheet via the excel, and has 5 columns of data (date (with the date and time), open, high, low, close) (excel format) ela
2011 Jan 04
1
XTS : merge.xts seems to have problem with character vectors
Hi, Please can you tell me what I am doing wrong. When trying to merge two xts objects, one of which has multiple character vectors for columns...I am just getting NAs. > str(t) POSIXct[1:1], format: "2011-01-04 11:45:37" > y2 = xts(matrix(c(letters[1:10]),5), order.by=as.POSIXct(c(t + 1:5))) > names(y2) = c(1,2) > y2 1 2 2011-01-04 11:45:38
2012 Mar 04
1
Store vectors as values in xts time-series object
Hi R programmers, I have stumbled across what seems a very simple problem. My goal is to create a xts time series object which contains vectors as values. In other words, I try to create something like this: 2009-01-01 => c('aa', 'bb', 'dd') ... 2010-02-01 => c('mm') I have figured out parts of separately. Here's what works (new xts time-series with
2015 Nov 04
1
setOldClass("xts")
Hello, I apologize that I am cross posting here after getting no answer from my initial question on stack overflow <http://stackoverflow.com/questions/33492601/r-setoldclass-only-if-needed>. I should certainly have posted it first here.. I am using 3 packages: - xts - quantmod - 'myPackage' quantmod is creating a union class by doing: setOldClass("xts");
2012 May 29
2
Converting to XTS loses data.frame structure
Hello, I noticed something odd when working with data frames and xts objects. If I read in a CSV file, R creates a nice data.frame. This works well. If I then convert to an XTS object, I see that all the values in the data are now quoted. My data is a mix of numeric and character. This is usually seen when converting a data.frame to a matrix, as R will treat all the data as the same class.
2011 Nov 09
1
Are there equivalents to xblocks or rect that can be used with plot.xts?
I would like to add vertical shaded blocks in plot.xts graphs (like recession periods in FRED graphs) The reason I use plot.xts instead of plot.zoo is that I like the fact that the grid is automatically aligned with major ticks in plot.xts. xblocks() and rect() do not seem to work with plot.xts (only with plot.zoo). Are there any alternative methods that work with plot.xts? Thanks. -- View
2010 Dec 06
1
as.xts error
Dear all, I am using the as.xts function to transfer a data frame to the xts The following is the code and result: a<-read.csv("price.csv") a$Date<-as.POSIXct(a$Date) str(a) 'data.frame': 15637 obs. of 2 variables: $ Date : POSIXct, format: "2010-01-04 09:45:01" "2010-01-04 09:45:02" "2010-01-04 09:45:03" ... $ bid_hsi: int 21850
2011 Dec 24
1
Optimising timeboxing in xts
I don't know if timeboxing is the correct term to use to accomplish what I'm attempting, so allow me to explain. I have a set n of tagged observations in time series t. What I'm interested in is taking i seconds before and after every n. My code is below: # observations.xts is an xts time series and arg is the number of seconds to for the timebox timeboxes <-
2017 Oct 06
2
Time series: xts/zoo object at annual (yearly) frequency
Hi, I'd like to make a time series at an annual frequency. > a<-xts(x=c(2,4,5), order.by=c("1991","1992","1993")) Error in xts(x = c(2, 4, 5), order.by = c("1991", "1992", "1993")) : order.by requires an appropriate time-based object > a<-xts(x=c(2,4,5), order.by=1991:1993) Error in xts(x = c(2, 4, 5), order.by =
2012 Nov 30
1
xts indexed with Date class
Hi I see a changed behaviour in xts indexed on class Date in the latest versions, versus 2. It seems to be related to changes to/from daylight savings time, happens those weekends. Is it not intended that class Date be used like this, or is this new behaviour incorrect? Giles Example: > a<-as.Date(15423:15426) > x<-xts(seq_along(a),a) > print(x) [,1] 2012-03-24
2012 Nov 02
2
override date in xts time series
Using the following bit of R, I'm wondering if there is a way to override/manipulate/replace the date in one xts time series with the date of another xts time series while not affecting/changing the times of the xts time series? library(xts) x.Date <- rep("1/1/2004",times=5) x.Times<- c("00:00:00", "00:15:00", "00:30:00",
2011 Oct 08
1
Filling missing days in xts time series
Hi, I have a bunch of irregularly spaced xts time series (with a POSIX index), and I'm trying to write a function that fillls the missing days. Using a solution suggested by Gabor Grothendieck for zoo, I wrote the following: # FD: Fill missing days FD<-function(ser) {rng<-range(time(ser)) > temp<-merge(ser,xts(,seq(rng[1],rng[2],"day"))) >