Displaying 20 results from an estimated 10000 matches similar to: "Strange zoo behaviour, possible bug?"
2008 Aug 11
1
A zoo question / problem
Hi
I'm having a problem using the zoo library and I can't see what I'm
doing wrong. For example setting up the data
> t1 = zoo (matrix (1:12, nrow = 3), order.by = as.Date
(c("2008-08-01","2008-08-02","2008-08-03")))
> colnames (t1) = c ("A", "B", "C", "D")
> t2 = zoo (matrix (1:12, nrow = 3), order.by =
2012 Dec 02
2
How to calculate mean of every nth time series data with zoo or xts ?
Hello,
I have 1-minute time series stock data and I'd like to calculate mean of every n-th candle data of m-days.
result = c(mean of 1th data, mean of 2nd data, ...)
mean of 1th data = (1th data of 2012-1-1 + 1th data of 2012-1-2 + 1th data of 2012-1-3) / 3
mean of 2nd data = (2nd data of 2012-1-1 + 2nd data of 2012-1-2 + 2nd data of 2012-1-3) / 3
...
Could you let me know the fastest
2008 Aug 21
1
max and min with the indexes in a zoo object (or anything else that could solve the problem)
library(zoo)
library(chron)
t1 <- chron("1/1/2006", "00:00:00")
t2 <- chron("1/31/2006", "23:45:00")
deltat <- times("00:15:00")
tt <- seq(t1, t2, by = times("00:15:00"))
d <- sample(33:700, 2976, replace=TRUE)
sin.zoo <- zoo(d,tt)
#there are ninety six reading in a day
d.max <- rollapply(sin.zoo, width=96, FUN=max)
2008 Sep 22
1
as.day() Function (zoo question)
I am was going to look at the as.yearmon function in the zoo package
and write a as.day function to aggregate a time series of 96
observations per day into the mean for each day, but I don't know how
to look at the code so that I can convert it into something I can use.
On top of that I believe that it is probably an S3 method and I
haven't quite gotten that far in my programming
2011 Aug 10
1
How to get the date of specific value within a zoo object?
Hi all,
I have a zoo time series object, see below code:
-------------------------------------------------------------------------------------------
# This is a pasteable example
library(zoo)
x <- c(1, 2, 3, 4, 5)
dt <- c("2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04", "201-01-05")
ts <- zoo(x, ts)
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:
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 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
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
2009 Aug 12
3
Zoo and numeric data
Hi,
I have a csv file with different datatypes:
2009-01-01, character1, 10, 20.1
2009-01-02, character2, 11, 21.1
(I have attached the file to this post)
I read this file with read.zoo as I want a zoo/xts timeseries:
> t = read.zoo("./data.txt", sep=",", dec = ".", header=FALSE)
If I look at the zoo data all integer/numeric columns are read as
character:
>
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 Jul 22
2
Picking returns from particular days of the month from a zoo object
Hello,
I would like to implement a "turn-of-the-month' trading strategy in R.
Given a daily series of stock market return data as a zoo object, the strategy
would go long (buy) four trading days before the end of the month, and sell the
third trading day of the following month.
How can I select these days, particularly the fourth day before and the third
day after the turn of the
2011 Jan 29
1
Basic Help with Zoo objects and trading days
All,
I have been just recently working with zoo objects for trading systems.
Can someone please help with these basic questions?
Given a daily time series downloaded using get.hist.quote() from the tseries
package, ie......
startDate= as.Date("2000-01-01")
endDate= as.Date("2011-01-29")
frequency= 'd'
s= get.hist.quote('IWF', start= startDate, end=
2010 Oct 25
4
zoo.read intraday data
Hello all,
I'm trying to use zoo.read but can't figure out
how to deal with the time format. (example below)
would be nice if someone could help.
best regards,
Immanuel
---------------------------
L <- "Date,Time,Open,High,Low,Close,Up,Down
05.02.2001,00:30,421.20,421.20,421.20,421.20,11,0
05.02.2001,01:30,421.20,421.40,421.20,421.40,7,0
2012 Jan 24
1
problems with rollapply {zoo}
Here is a relatively simple script (with comments as to the logic
interspersed):
# Some of these libraries are probably not needed here, but leaving them in
place harms nothing:
library(tseries)
library(xts)
library(quantmod)
library(fGarch)
library(fTrading)
library(ggplot2)
# Set the working directory, where the data file is located, and read the
raw data
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 =
2009 Dec 22
1
Using zoo() to aggregate daily data to monthly means
I am trying to get monthly means for a daily data series using zoo(). I have
found an odd problem, that seems to be caused by zoo()'s handling of leap
years.
Here's my R script with 2 methods (freq=365, 366) for aggregating the daily
data to monthly series:
library(zoo)
J_link <- "http://www.ijis.iarc.uaf.edu/seaice/extent/plot.csv"
JAXA_data <- read.table(J_link,
2012 Oct 01
3
merge.zoo returns unmatched dates
Sorry for the lack of reproducible data, but this seems to be a problem inherent to my dataset and I can't figure out where the issue is.
I have several data frames set up as a time series with identical POSIXct date formats. If I keep the original data in data frame format and merge them using base merge- everything is perfect and everyone is happy.
If I transform the data frames to zoo
2008 Oct 22
1
R 2.8.0 qqnorm produces error with object of class zoo?
Dear list-reader,
by running the following script:
library(zoo)
sessionInfo()
search()
packageDescription("zoo")
data(EuStockMarkets)
dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
daxr <- diff(log(dax))
identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
qqnorm(coredata(daxr))
qqnorm(daxr)
qqnorm() produces an error:
> qqnorm(daxr)
Fehler in if (xi == xj) 0L
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