similar to: cbind for list of zoo objects

Displaying 20 results from an estimated 20000 matches similar to: "cbind for list of zoo objects"

2010 Jul 31
1
Lags and Differences of zoo Objects
Hi, I'm struggling to understand the documentation. ?lag.zoo x - a "zoo" object. k, lag - the number of lags (in units of observations). Note the sign of k behaves as in lag. differences - an integer indicating the order of the difference. What does the above line actually mean? I've tried a few settings on sample data but can't figure out what it is doing. x <-
2009 Mar 15
1
cbind(NULL,zoo.object)?
Folks, I often build up R objects starting from NULL and then repeatedly using rbind() or cbind(). This yields code like: a <- NULL for () { onerow <- craft one more row a <- rbind(a, onerow) } This works because rbind() and cbind() are forgiving when presented with a NULL arg: they act like nothing happened, and you get all.equal(x,rbind(NULL,x)) or all.equal(x,cbind(NULL,x)).
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
2010 Aug 11
2
Sweeping a zoo series
Given a long zoo matrix, the goal is to "sweep" out a statistic from the entire length of the sequences. longzoomatrix<-zoo(matrix(rnorm(720),ncol=6),as.yearmon(outer(1900,seq(0,length=120)/12,"+"))) cnames<-c(12345,23456,34567,45678,56789,67890) colnames(longzoomatrix)<-cnames longzoomatrix[1:24,] 12345 23456 34567 45678
2011 Jul 26
2
Calculate the latest Z-score of all zoo time series
Hello, I have a population of 2000+ zoo time series (but my environment also contains objects that are not zoo time series). I'm trying to calculate the latest 90 days Z-Score of all zoo time series, using the following code: LZS<-function(ser) { temp<-window(ser,start=Sys.Date()-90) last((temp-mean(temp))/sd(temp)) } sapply(ls(), LZS ) The LZS function works on individual zoo time
2012 Nov 13
2
Can't format x axis on a stacked plot of a zoo object
As an example data set: set.seed(1) z.Date <- as.Date(paste(2003, 02, c(1, 3, 7, 9, 14), sep = "-")) z <- zoo(cbind(left = rnorm(5), right = rnorm(5, sd = 0.2)), z.Date) tt<-time(z) fmt<-"%b-%d" labs<-format(tt,fmt) plot(z[,1], xlab = "Time", ylab = "") If I plot the data and don't like the format of the x axis I can do this:
2006 Oct 28
2
subsetting, aggregating and zoo
Hi, Having an zoo object I can subset it to obtain the days where I have the values within some range: is.zoo(z) TRUE subset(z[,1], z[,1]>=5 & z[,1]<= 10) #Yields: Year(day) 1988(13) 1988(14) 1988(16) 1988(20) 1988(21) 1988(22) 1988(25) 1988(26) 7.973946 9.933518 7.978227 7.512960 6.641862 5.667780 5.721358 6.863729 1988(27) 1988(28) 1988(29) 1988(30) 1988(32)
2007 Feb 01
3
Lining up x-y datasets based on values of x
Hi, I was wondering if there is a direct approach for lining up 2-column matrices according to the values of the first column. An example and a brute-force approach is given below: x <- cbind(1:10, runif(10)) y <- cbind(5:14, runif(10)) z <- cbind((-4):5, runif(10)) xx <- seq( min(c(x[,1],y[,1],z[,1])), max(c(x[,1],y[,1],z[,1])), 1) w <- cbind(xx, matrix(rep(0, 3*length(xx)),
2007 May 27
1
na.approx and columns with NA's
Hi, I have a object 'zoo': dim(zz) [1] 720 5551 where some columns only have NA's values (representing land data in a sea surface temperature dataset) I find straightforward the use of 'na.approx' for individual columns from the zz matrix, but when applied to the whole matrix: zz.approx<-na.approx(zz) Erro en approx(along[!na], y[!na], along[na], ...) : need
2007 Oct 02
2
zoo timeserie continuous? complete with NaN
dear r-list I have a zoo object with 2 objects and time: looks like: 2005-12-31 12:00:00 NA NaN 2005-12-31 13:00:00 NA NaN 2005-12-31 14:00:00 NA NaN 2005-12-31 15:00:00 NA NaN 2005-12-31 16:00:00 NA NaN 2005-12-31 18:00:00 NA NaN 2005-12-31 19:00:00 NA NaN 2005-12-31 20:00:00 NA NaN 2005-12-31 21:00:00 NA
1999 Nov 10
2
data.frame, cbind is inconsistent with S on logicals (PR#316)
R 0.65.1 (and R-devel 09/11/99) > z <- data.frame(a=1:3) > b <- rep(NA, 3) > mode(b) [1] "logical" # how many of you expected that? I had forgotten! > zz <- cbind(z, b) > zz a b 1 1 NA 2 2 NA 3 3 NA > class(zz$b) [1] "factor" whereas in S it is NULL and zz$b is of mode "numeric". The same thing happens with data.frame zz <-
2008 Mar 13
4
plotting zoo object
JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC 1968 NA 10.7 10.0 9.3 7.4 8.1 9.3 9.5 8.5 10.0 10.0 13.0 1969 13.0 9.9 7.0 5.9 NA 6.5 7.3 6.6 NA NA NA NA 1970 10.7 8.9 8.1 NA NA 7.1 7.7 NA 6.5 NA 8.3 NA 1971 NA 11.6 NA NA 7.8 NA NA 6.2 NA NA 8.4 NA x<-read.zoo("textconnection", sep=",", format= "%Y", header=TRUE) plot(x) #this plots all of the years by each
2010 Mar 04
2
missing date and time intervals in data frame
I posted a similar question, but feel it needs a bit more elaboration. I have a data frame (read from a csv file) that may have missing rows. Each day has 7 time intervals associated with it, with a range from 17:00 hrs to 18:00 hrs in 10 minute bins. What I am looking for is a script that will run through the data frame and insert "NA"in the Volume column for any dates that are
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
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 in zoo(structure(x, dim = dim(x)), index(x), ...) : “x” : attempt to define
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
2011 Apr 03
1
R-project: plot 2 zoo objects (price series) that have some date mis-matches
I have 2 zoo objects - 1) Interest rate spread between 10-YR-US-Treasury and 2-YR-US-Treasury (object name = sprd) 2) S&P 500 index (object name = spy) > str(spy) ?zoo? series from 1976-06-01 to 2011-03-31 Data: num [1:8791] 99.8 100.2 100.1 99.2 98.6 ... Index: Class 'Date' num [1:8791] 2343 2344 2345 2346 2349 ... > str(sprd) ?zoo? series from 1976-06-01 to 2011-03-31
2009 Oct 09
2
different time series in one plot
Hello, I need to put 2 or more different time series to one plot for comparison each other. The problem is that the time series are irregular, moreover the time lenghts and periods are not the same. Is there a way to manage it in R? Many thanks for any hint and advice in advance Tomas
2010 Jun 08
3
more dates and data frames
Dear R People: So thanks to your help, I have the following: > dog3.df <- read.delim("c:/Users/erin/Documents/dog1.txt",header=FALSE,sep="\t") > dog3.df V1 V2 1 1/1/2000 dog 2 1/1/2000 cat 3 1/1/2000 tree 4 1/1/2000 dog 5 1/2/2000 cat 6 1/2/2000 cat 7 1/2/2000 cat 8 1/2/2000 tree 9 1/3/2000 dog 10 1/3/2000 tree 11 1/6/2000 dog 12 1/6/2000
2012 Aug 03
1
How can I read time series data to create zoo objects if I have two title lines?
Hello, This is a standard example in which I read the time series data from a csv file and create a zoo object: x0 <- read.csv(file="CPI.csv", header=TRUE) time_0<-as.yearmon("1981-01")+(0:371)/12 x0zoo<-zoo(x0, time_0) The data look like this: TIME CPI CPI_food CPI_Clothes CPI_House CPI_Rent 198101 62.1 55.34 103.45 65.24 61.43 198102 63.16 56.95