Displaying 20 results from an estimated 10000 matches similar to: "aggregate.zoo on bivariate data"
2011 Jan 24
2
how to slice a zoo object
Hi
Would anyone have any pointers on how to slice up a large zoo table. I
have the following structure: -
> str(ZOO_OBJ)
?zoo [1:632, 1:83] 30.4 30.4 30.4 30.4 30.3 ...
?- attr(*, "dimnames")=List of 2
??..$ : NULL
??..$ : chr [1:83] "COL1" "COL2" "COL3" "COL4" ...
?- attr(*, "index")= POSIXct[1:632], format: "2009-05-01
2011 Sep 27
2
Coercing a character zoo to a numeric
Dear R-helpers,
It seems to me that a character zoo cannot be coerced to a numeric zoo.
Below is a minimal example. Can someone tell me what I have done wrong?
> z<-zoo(1:4,order.by=1:4)
> coredata(z)<-as.character(coredata(z))
> str(z)
‘zoo’ series from 1 to 4
Data: chr [1:4] "1" "2" "3" "4"
Index: int [1:4] 1 2 3 4
>
2012 Jun 06
2
package zoo, function na.spline with option maxgap -> Error: attempt to apply non-function?
Hello,
I'm trying to use na.spline (package zoo) to fill some missing data in a time series.
this works fine, however, if I apply the 'maxgap' argument, I always get the error:
<------
Error in na.spline.vec(x., coredata(object.), xout = xout., ...) : attempt to apply non-function
------>
I couldn't find a similar error for this case in the mailing lists and zoo vignette,
2011 Apr 03
1
zoo:rollapply by multiple grouping factors
# Hi there,
# I am trying to apply a function over a moving-window for a large
number of multivariate time-series that are grouped in a nested set of
factors. I have spent a few days searching for solutions with no luck,
so any suggestions are much appreciated.
# The data I have are for the abundance dynamics of multiple species
observed in multiple fixed plots at multiple sites. (I total I
2011 Mar 15
2
Pointwise division of two zoo objects?
Just trying to create returns from prices, and do something like:
returns.z = tail(prices.z,-1)/head(prices.z,-1) - 1 # should be equivalent
to returns = exp(diff(log(prices.z))) - 1
Curiously, I get a zoo object back with zeros everywhere and also with the
index having one fewer element than it should.
Does anyone know how to pointwise divide zoo objects, and what exactly "/"
is
2009 Jun 19
1
(FULL) Need help to optimize a piece of code involving zoo objects
(Sorry, sent the message before I finished it)
Hello, everyone
I have a long script that uses zoo objects. In this script I used
simple moving averages and these I can very efficiently calculate with
filter() functions.
Now, I have to use special "exponential" moving averages, and the only
way I could write the code was with a for-loop, which makes everything
extremely slow.
I don't
2009 Jun 19
1
Need help to optimize a piece of code involving zoo objects
Hello, everyone
I have a long script that uses zoo objects. In this script I used
simple moving averages and these I can very efficiently calculate with
filter() functions.
Now, I have to use special "exponential" moving averages, and the only
way I could write the code was with a for-loop, which makes everything
extremely slow.
I don't know how to optimize the code, but I need to
2006 Nov 29
2
problem with indexing a zoo object
My problem is the following : I create 2 zoo objects and then I try to
subset one of them using logic. indicesthatpass is a vector of trues and
falses but when I send it into bckret, it returns an empty bckret.
Obviously it has something to do with bckret being a zoo object and if I
do the same subsctripting off of coredata(bckret), I'm confident it will
work. But, I need to keep the minute
2012 Mar 25
1
Struggling with zoo and aggregate
All:
I have a SQlite database where I have stored some verification data by date
& time (cycle Z/UTC), lead_time as well as type, duration, etc. I would
like to analyze & plot the data as monthly averages. I have looked at a
bunch of examples which use some combination of zoo and aggregate, but I
have not been able to successfully apply bits and pieces from the examples
I have found. Any
2006 Nov 23
1
Problem with as.ts(zoo-object)
Dear all,
I have an error message, when I try to convert a zoo object (called
test) to ts (on R 2.4.0, Package zoo version 1.2-1, Windows XP)
> test
1994-05-10 1994-06-09 1994-07-09
0.0024943889 0.0024881824 0.0006955831
> str(test)
atomic [1:3] 0.002494 0.002488 0.000696
- attr(*, "index")=Class 'Date' num [1:3] 8895 8925 8955
> is.regular(test)
[1] TRUE
2011 Sep 30
1
last observation carried forward +1
Hi R-helpers
I'm looking for a vectorised function which does missing value replacement
as in last observation carried forward in the zoo package but instead of a
locf, I would like the locf function to add +1 to each time a missing value
occurred. See below for an example.
> require(zoo)
> x <- 5:15
> x[4:7] <- NA
> coredata(na.locf(zoo(x)))
[1] 5 6 7 7 7 7 7 12 13
2005 Apr 28
0
update: zoo 0.9-9
Dear useRs,
a new version of the zoo package for totally ordered observations is
available from CRAN. It contains many new features, the most important
of which are: support of regular time series, an improved merge method
and functions for carrying out rolling analyses of time series. A more
detailed list of changes and new features is given below.
All features (both old and new) are also
2005 Apr 28
0
update: zoo 0.9-9
Dear useRs,
a new version of the zoo package for totally ordered observations is
available from CRAN. It contains many new features, the most important
of which are: support of regular time series, an improved merge method
and functions for carrying out rolling analyses of time series. A more
detailed list of changes and new features is given below.
All features (both old and new) are also
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
2009 Mar 03
1
zoo and coredata() classes
Hi guys
I have a reasonably basic question with zoo usage, but I havent been able
to find a satisfactory workaround yet.
Heres a simple example of what I'm talking about (the following data frame
contains numeric columns that contains NAs):
> head(ebs)
time src tstamp code bid ask
1 2009-03-03 13:03:29.536 perf.Tib_listener 14980321164
EBS.REC.EURJPY=EBS.NaE 123.48 NA
2 2009-03-03
2007 Jul 31
1
A complicated 'aggregate'
Hi,
I have a financial (zoo) time series with prices and volumes (although I can
get the coredata as a matrix). Due to the data-source some indices have
multiple observations. I want to aggregate these according to a weighted
average.
11:00:01 34 1000
11:00:01 35 500
11:00:01 35 1000
11:00:02 34 500
11:00:02 35 500
should become
11:00:01 34.6 2500
11:00:02 34.5 1000
I currently do this
2012 Feb 28
1
aggregating specific parts in zoo index column to perform sliding average
Here's my code:
http://pastebin.com/0yRxEVtm
The important parts are uncommented and should be easy to find using the
link above. For the following line of code, I plan on looking for a way to
offset it up 7 rows so that the 15 minute timestamp would be considered the
"median" of the subset being averaged to find the mean:
avgCool = aggregate(intCool, trunc(time(intCool),
2012 May 28
2
zoo: variable gets modified at making zoo object
I'm doing:
> alyL32007z <- zoo(alyL32007,alyL32007$time)
> range(time(alyL32007z))
[1] "2007-01-01 00:00:00 UTC" "2007-12-31 23:30:00 UTC"
But then, while the original variable is:
> summary(alyL32007$NEE_st)
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
-15.340 -1.615 -0.054 -0.814 0.750 8.965 11124
the variable within the zoo object
2011 May 26
2
zoo column names
I have a zoo object that contains 2 time series named "A-B" and "V1".
When I create a third series "V2", the name of the "A-B" series is changed
to "A.B".
Although I could recreate the names for the 3 series I am wondering if there
is a way of preventing the name change from happening ( ... maybe an
equivalent of the keep.names=TRUE statement
2010 Aug 20
1
differecing a zoo series
A quick question
x <- as.yearmon(2000 + seq(0, 23)/12)
x
[1] "Jan 2000" "Feb 2000" "Mar 2000" "Apr 2000" "May 2000" "Jun 2000" "Jul
2000" "Aug 2000" "Sep 2000" "Oct 2000" "Nov 2000" "Dec 2000" "Jan 2001"
[14] "Feb 2001" "Mar 2001" "Apr