Displaying 20 results from an estimated 4000 matches similar to: "Create a zoo/xts Time Series with Millisecond jumps"
2011 Mar 04
4
xts POSIXct index format
Hi,
I cannot figure out how to change the index format when displaying POSIXct
objects.
Would like the xts index to display as %H:%M:%OS3 when doing viewing the xts
object.
Think I am missing the obvious.
Cheers,
Chris
--
View this message in context: http://r.789695.n4.nabble.com/xts-POSIXct-index-format-tp3336136p3336136.html
Sent from the R help mailing list archive at Nabble.com.
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
2011 Jan 10
2
Aggragating subsets of data in larger vector with sapply
Have 40,000 rows of buy/sell trade data and am trying to add up the buys for
each second, the code works but it is very slow. Any suggestions how to
improve the sapply function ?
secEP = endpoints(xSym$Direction, "secs") # vector of last second on an XTS
timeseries object with multiple entries for each second.
d = xSym$Direction
s = xSym$Size
buySize = sapply(1:(length(secEP)-1),
2011 May 28
1
How to do operations on zoo/xts objects with Monthly and Daily periodicities
Is there an elegant way to do operations (+/-/*/ / ) on zoo/xts objects when
one serie is monthly (end of month) and the other daily (weekdays only) -
typically a monthly economic indicator and a stock index price?
Thanks,
TDB
--
View this message in context: http://r.789695.n4.nabble.com/How-to-do-operations-on-zoo-xts-objects-with-Monthly-and-Daily-periodicities-tp3558081p3558081.html
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 =
2010 May 17
1
Isn't aggreate.zoo supposed to work with POSIXct (zoo/TTR/xts issue)?
library(xts)
library(TTR)
ndx = getYahooData("^NDX")
aa = ndx$Close
bb = aggregate(aa, as.yearweek, tail, 1)
The last operation takes forever, and then the bb dates are messed up. The following produces the desired result:
time(aa) = as.Date(time(aa))
bb = aggregate(aa, as.yearweek, tail, 1)
The index of ndx and aa is of POSIXct (as reported by is(time(ndx))) , which apparently
2010 Apr 18
4
confused with yearmon, xts and maybe zoo
R-listers,
I am using xts with a yearmon index, but am getting some inconsistent
results with the date index when i drop observations (for example by using
na.omit).
The issue is illustrated in the example below. If I start with a monthly
zooreg series starting in 2009, yearmon converts this to "Dec-2008". Not
such a worry for my example, but strange. Having converted to xts, i drop
2012 Nov 27
2
Books for fully understanding internal logics on some packages(quantmod, xts, zoo and chron)
Hello,
I'm very interested in using financial time series data, but I'm a beginner of R programming.
I'd like to fully understand internal logics on several time-series related packages such as quantmod, xts, zoo, chron, etc.
So, I read some books, 'R Cookbook' and 'Art of R Programming' and another simple tutorials.
But I still can't understand grammars of the
2011 Jan 23
1
Plotting multiple xts/zoo time series on a single plot.
So I've got a 154 column wide xts time series object and I want to plot the
154 series on a single plot and have the added benefit of the time series
dates on the x axis.
Any suggestions for plotting functions, maplot works but does not give dates
on the axis and I can't seem to get plot to give me more than one series.
Nick
[[alternative HTML version deleted]]
2011 Mar 24
4
Millisecond TimeStamps
I am wondering if there is a good way to work with data that is indexed in
time, via timestamps with a resolution in milliseconds. As I understand it,
the POSIX classes have a resolution i n terms of seconds, and will not
process fractional seconds from a string. Is this correct. I realize that
this may be a little unclear. Here is what I am trying to do:
A data frame with a time series
2011 Jan 03
2
Regex to remove last character
Hi,
Have been having trouble trying to figure out the right regex parameters to
remove the last "." in timestamp with the following format:
Convert 09:30:00.377.853 to 09:30:00.377853
Thanks,
Chris
--
View this message in context: http://r.789695.n4.nabble.com/Regex-to-remove-last-character-tp3172466p3172466.html
Sent from the R help mailing list archive at Nabble.com.
2009 Sep 25
0
differing behaviour between xts (0.6-7) and zoo (1.5-8)
Folks,
I have some weekly dataseries that I convert to monthly xts (with
yearmon indices), and obtain the two following extracts:
> str(sig)
An 'xts' object from Apr 1998 to Sep 1998 containing:
Data: num [1:6, 1] 0.0083 0.2799 -0.2524 -0.0119 0.18 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr "e1"
Indexed by objects of class: [yearmon] TZ:
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");
2009 Nov 12
1
xts conversion problem
I have two data frames, with two columns each, the first being a Date
variable. I would like to convert them to xts objects, indexed by the
Date column. I would like to use as.Date and not as.POSIXct as the
dateformat. The puzzling fact is that it works for the first one but
not the other. Here is a screenshot of the error:
> str(DF1)
'data.frame': 367 obs. of 2 variables:
$
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 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 <-