search for: zoo

Displaying 20 results from an estimated 2024 matches for "zoo".

2006 Nov 01
3
matrix manipulation with a for loop
Hi, Having a matrix F.zoo (6575,189) with NA's in some columns I'm trying to extract from each column the percent of days within an specific range, so I've wrote this procedure: length(subset(F.zoo[,86],(F.zoo[,86]>=5) & (F.zoo[,86]<= 9)))/(length(F.zoo[,86])-length(subset(F.zoo[,86],is.na(F.zoo[,8...
2009 Mar 21
4
Problem with zoo and rbind() converting matrix to vector
require( zoo ) inp <- c( 5, 9, 4, 2, 1 ); m <- zoo( cbind( inp ), as.Date("2003-02-01") + (0:(length(inp)-1))); dim( m ) # [1] 5 1 dim( m[1,,drop=FALSE] ) # [1] 1 1 - ok dim( lag( m, -1 )) # [1] 4 1 - ok dim( rbind( m[1,,drop=FALSE], lag(m,-1) )) # NULL - converted from zoo matrix to zoo vecto...
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: > str(t) ?zoo? series from 2009-01-01 to 2009-01-02 Data: chr [1:2, 1:3] " characte...
2006 Jul 11
2
detach
We try the following: search() as.Date(1) zoo:::as.Date.numeric under three circumstances: 1. on a fresh session 2. after issuing library(zoo) noting that as.Date.numeric is provided by zoo 3. after detaching zoo as.Date(1) fails on #1 but succeeds in #2 and #3. Should it not fail in #3 since zoo was detached? Is this how its supposed to...
2011 Nov 13
2
cannot load zoo package
Using: Mac OS 10.7.2 R version 2.13.2 I cannot load the zoo package. The install runs fine but when trying to load it i get the following error: /Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/Users/ntyhurst/Library/R/2.13/library/zoo/libs/i386/zoo.so': dlopen(/Users/ntyhurst/Library/R/2.13/library/zoo/libs/i...
2011 Sep 08
1
Seasonal and 11-day subset for zoo object
I have a zooreg object and I want to be able to generate a value for seasons and 11-day composites paste it onto my zoo data frame, along with year, month and days. Right now I have the following to work from: eg. dat.zoo.mdy <- with(month.day.year(time(dat.zoo)), cbind(dat.zoo, year, month, day, quarter =...
2008 Nov 16
1
inconsistency between timeSeries and zoo causing a problem with rbind
Dear R Users and maintainers of packages zoo and timeSeries, I believe there is a recently introduced inconsistency between timeSeries and zoo which is causing a problem with rbind. I had previously reported that I was having problems with rbind in the following code: library(zoo) foo<-zoo(1,order.by=as.Date("2007-10-09")) b...
2006 Dec 27
5
plotting time series with zoo pckg
Hi all, I am using the zoo package to plot time series. I have a problem with formatting the axes. my zoo object (z) looks like the following. c1 1992-01-10 21 1992-01-17 34 1992-01-24 33 1992-01-31 41 1992-02-07 39 1992-02-14 38 1992-02-21 37...
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"...
2004 Dec 23
0
zoo 0.9-1
Dear useRs, a new and much improved version of the zoo package for indexed totally ordered observations (such as irregular time series) is available from CRAN. It allows indexing observations with time/index vectors of arbitrary class and extends many of the standard generic functions also available for "ts" objects. Additionally, it allows c...
2004 Dec 23
0
zoo 0.9-1
Dear useRs, a new and much improved version of the zoo package for indexed totally ordered observations (such as irregular time series) is available from CRAN. It allows indexing observations with time/index vectors of arbitrary class and extends many of the standard generic functions also available for "ts" objects. Additionally, it allows c...
2012 Jul 31
2
How can I declare an empty zoo object?
Hi, I let xzoo be an empty object: > xzoo<-{} and I have an existing zoo object x1zoo_f. I would like to combine the two to make a new zoo object, and continue doing so in a loop, which is not shown here. However, when I type > xzoo<-cbind(xzoo, x1zoo_f) An error message emerges Error...
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)...
2008 Sep 02
1
R Newbie: quantmod and zoo: Warning in rbind.zoo(...) : column names differ
Hello; I am trying following but getting a warning message : Warning in rbind.zoo(...) : column names differ, no matter whatever I do. Also I do not want to specify column names manually, since I am just writing a wrapper function around getSymbols to get chunks of data from various sources - oanda, dividends etc. I tried giving col.names = T/F, header = T/F and skip = 1 but n...
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",head...
2012 Nov 01
2
Subsetting year range
...It would be really nice if someone can point out what I am doing wrong with this part, or somewhere else that I am coding wrong. Thanks, Full code: ########### TableAP <- read.csv("AnnualPanel.csv") TableAP <- data.frame(TableAP) TableAP nrow (TableAP) install.packages("zoo") require(zoo) Lagpolity4AP1 <- lag(zoo(TableAP$polity4), -1) Lagpolity4AP2 <- lag(zoo(TableAP$polity4), -2) Lagpolity4AP3 <- lag(zoo(TableAP$polity4), -3) Lagpolity4AP4 <- lag(zoo(TableAP$polity4), -4) Lagpolity4AP5 <- lag(zoo(TableAP$polity4), -5) LaglrgdpchAP1 <- lag(zoo(...
2011 Sep 13
1
ZOO: Learning to apply it to my data
I have read ?zoo but am not sure how to relate the parameters (x, order.by, frequency, and style) to my data.frame. The structure of the data.frame is 'data.frame': 11169 obs. of 4 variables: $ stream : Factor w/ 37 levels "Burns","CIL",..: 1 1 1 1 1 1 1 1 1 1 ... $ sampdate: Date...
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_da...
2012 Feb 18
2
still need read.zoo command help
The problem now is it looks like my read.zoo isn't working. Sorry for sort of double posting. Someone please assist if you have time with my read.zoo command line. my data is as just below this line, a time stamp and a real number with a comma sep. 10/11/2011 23:00:06,432.12 z=read.zoo("Kevin-0-comma-ITPower.txt",...
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...