Displaying 20 results from an estimated 2000 matches similar to: "xts POSIXct index format"
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 Mar 02
1
Create a zoo/xts Time Series with Millisecond jumps
Is there a easy way to create the time index for a zoo/xts object for every
100 milliseconds.
eg. time Index would be:
10:00:00:100
10:00:00:200
10:00:00:300
10:00:00:400
I am looking to build an empty zoo/xts object with time index from 10am to
3pm, index jumps by 100ms each row.
Thanks,
Chris
--
View this message in context:
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 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.
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 Oct 11
2
Slow reading multiple tick data files into list of dataframes
Hi,
I am trying to find the best way to read 85 tick data files of format:
> head(nbbo)
1 bid CON 09:30:00.722 09:30:00.722 32.71 98
2 ask CON 09:30:00.782 09:30:00.810 33.14 300
3 ask CON 09:30:00.809 09:30:00.810 33.14 414
4 bid CON 09:30:00.783 09:30:00.810 33.06 200
Each file has between 100,000 to 300,300 rows.
Currently doing nbbo.list<-
2011 Mar 18
1
Replace split with regex for speed ?
Have timestamp in format HH:MM:SS.MMM.UUU and need to remove the last "." so
it is in format HH:MM:SS.MMMUUU.
What is the fastest way to do this, since it has to be repeated on millions
of rows. Should I use regex ?
Currently doing it with a string split, which is slow:
>head(ts)
[1] 09:30:00.000.245 09:30:00.000.256 09:30:00.000.633 09:30:00.001.309
09:30:00.003.635
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 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
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 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")))
>
2012 Feb 16
3
Converting ts into xts and subsetting
Greetings,
I would like to subset observations in a time series using xts, after
converting from ts to xts.
X=ts(1:100, frequency=12, start=c(1976))
X2=as.xts(X)
X2["1984"]
The output:
Feb 1984 98
Mar 1984 99
Apr 1984 100
What happened to January? The index is always one month off, with
X2["1976-01"] giving me Feb 1976. Should I set the time using something
else
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 <-
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 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 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
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 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
2013 Mar 16
2
Find NA in xts object
Hi to all, i'm new to R
I have an xts object.
Can i find:
a) how many NA are in my object ?
b) eventually where (in which line) they are
Thank you