similar to: zoo arithmetics

Displaying 20 results from an estimated 10000 matches similar to: "zoo arithmetics"

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 >
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
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
2010 Jan 29
1
use zoo package with multiple column data sets
Readers, I am trying to use the zoo package with an array of data: file1: hh:mm:ss 1 hh:mm:ss 2 hh:mm:ss 3 hh:mm:ss 4 file2: hh:mm:ss 11 55 hh:mm:ss 22 66 hh:mm:ss 33 77 hh:mm:ss 44 88 I wanted to merge these data set so I tried the following commands: library(chron) library(zoo) z1<-read.zoo("path/to/file1.csv",header=TRUE,sep=",",FUN=times)
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
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
2006 Nov 03
1
as.zoo behavior (
hi all : the code pasted below runs but then, a dput on rollmeandifflogbidask gives me what is below the code. the structure of rollmeandifflogbidask is a zoo object but with a "frequency" so it's not the same structure as the original actual diff and this really causes things to blow up in later code. i'm sure gabor and achim know what to do but in the case that they are not
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 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
2010 May 16
3
Vector recycling and zoo
I am a bit confused about the different approaches taken to recycling in plain data frames and zoo objects. When carrying out simple arithmetic, dataframe seem to recycle single arguments, zoo objects do not. Here is an example > x <- data.frame(a=1:5*2, b=1:5*3) > x a b 1 2 3 2 4 6 3 6 9 4 8 12 5 10 15 > x$a/x$a[1] [1] 1 2 3 4 5 > x <- zoo(x) > x$a/x$a[1] 1 1 >
2010 Aug 25
2
Repeat the first day data through all the day. Zoo
down vote favorite Hello I have a zoo series. It lasts 10 years and its frequency is 15min. I'd like to get a new zoo series (or vector) with the same number of elements, whith each element equal to the first element of the day. That's, The first element everyday is repeated throughout the wole day. This is not same as aggregate(originalseries,as.Date,head,1) because this gives a
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
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 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
2008 Mar 06
1
can't merge zoo ojects and convert to ts (been trying for 2 days)
I'm stuck, but am sure it can be done I just don't understand how. I have data in an irregular timeseries. I want to be able to use stl to visualise the data (see seasonal parts etc), so I need to change to regular series of class ts (I think). I am using 2 zoo objects one is regular and the other is my irregular data. I am then merging to create the object I want but when I try to change
2009 Sep 27
2
zoo: merging aggregated zoo-objects fails
Dear all, I have several text files looking like this: 9063032 19700201 22:00 174.067 9063032 19700201 23:00 174.076 9063032 19700202 00:00 174.085 9063032 19700202 01:00 174.091 9063032 19700202 02:00 174.094 9063032 19700202 03:00 174.091 9063032 19700202 04:00 174.082 9063032 19700202 05:00 174.079 And I run this loop: for (j in 1:nr.of.files) { #Import: DF <-
2008 Mar 03
1
Formating a zoo dataset .
Suppose I have following dataset : > head(data1) Date Return 1 03/31/00 0.14230650 2 04/28/00 -0.03276228 3 05/31/00 -0.06527890 4 06/30/00 -0.04999873 5 07/31/00 -0.01447902 6 08/31/00 0.22265729 Now I convert it to zoo object : > data11 = zoo(data1[,2], as.Date(data1[,1], format="%m/%d/%y")) > head(data11) 2000-03-31 2000-04-28 2000-05-31
2008 Mar 03
1
write csv file from zoo object
# chron library(chron) fmt.chron <- function(x) { chron(sub(" .*", "", x), gsub(".* (.*)", "\\1:00", x)) } z1 <- read.zoo(SC3.csv, sep = ",", header = TRUE, FUN = fmt.chron) z2 <- read.zoo(SC2.csv, sep = ",", header = TRUE, FUN = fmt.chron) z3<-c(z1, z2) write.table(z3, sep="," , "SC.csv") How do you
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: