Questions tagged [zoo]

zoo is an R package that provides an S3 class with methods for totally ordered indexed observations.

zoo ("Z's Ordered Observations") is an package for analysis of regular and irregular time series.

It provides an class with methods for totally ordered indexed observations. It is particularly aimed at irregular of numeric vectors/matrices and factors. zoo's key design goals are independence of a particular index/date/time class and consistency with ts in base-R by providing methods to extend standard generics.

Repositories

Vignettes

Other resources

Related tags

1328 questions
0
votes
2 answers

Convert time series with 3-seconds update to time series with other interval

I have a large file of measurements with 3-second period (here is a small part of it). I made time serie: library(zoo) fmt<-"%d.%m.%y %H:%M:%S" dat <- read.zoo("~/Institut/Monitor/UA_test.csv",header=TRUE, …
Maxim
  • 33
  • 4
0
votes
1 answer

how to read a .csv file as time series using zoo?

I am trying to read a .csv file into R as time series using zoo package.That's what I've written so far: tbl<-as.xts(read.zoo("~//Documents//thesis research//myseries (version 1)2.csv",sep="/",header=T,format=%m/%d/%Y)) I 've got a following error…
user3546838
  • 89
  • 1
  • 1
  • 3
0
votes
1 answer

Loading Data in R with zoo

I've figured out how to load historical financial data from Google using the following code: slb <- read.table( "slb.csv", header=TRUE, sep=",", col.names=c("date","open","high","low","close","volume") ) slb$date <- as.Date( slb$date, "%d-%b-%y"…
cjohnson318
  • 3,154
  • 30
  • 33
0
votes
1 answer

Get most recent index value, which is available in both ZOO objects

For example, I have two ZOO objects: x <- zoo(matrix(1:10, 10, 2), 1:10) y <- zoo(matrix(11:20, 10, 2), 5:15) I want to get first index value, which have both ZOO objects. In this example it must be index value of 5. Because index of 5 have both…
Eldar Agalarov
  • 4,849
  • 4
  • 30
  • 38
0
votes
1 answer

how to extract all values from a data frame by month for years

I have data in a zoo data structure. I want to pull all August daily vaules over 10 years and compute monthly statistics for a period of record. Any thoughts on easy way to do this?
dchawk
  • 1
0
votes
1 answer

R - Losing column heading with read.zoo (read.csv is fine)

When I read a csv file with read.zoo, the first column name is not imported and cannot be referenced. Reading the same file with read.csv is fine: > BoE101<- read.csv(file="C:/Users/Charles/Documents/R/Working files/BoE100.csv", …
Charles Brewer
  • 183
  • 2
  • 12
0
votes
1 answer

Error in order(x, ..., na.last = na.last, decreasing = decreasing) :argument 1 is not a vector?

I have huge data.frame, a sample of which looks as shown below: df <- read.table(header=TRUE, text=" id BSheetyearlag sd 1001 Mar-1997 0.50 1001 Mar-1997 0.40 1001 Mar-1997 0.30 1001 Mar-1997 0.20 1001 Mar-1997 …
Jack
  • 167
  • 2
  • 12
0
votes
1 answer

R read.zoo error for incorrect date format

I have a data that has one date column and 10 other columns. The date column has the format of 199010. so it's yyyymm. It seems like that zoo/xts requires that the date has days info in it. Is there any way to address this issue? hier ist my…
purpleblau
  • 589
  • 2
  • 7
  • 18
0
votes
2 answers

Moving average or sum calculation on multiple vectors in irregular time series

I have a dataframe that looks like this (dput is below): Date SiteSub HeatingDegreeDay MCnt MCnt_lag7 MCnt_lag9 2009-11-01 EC_BC.Z_Z 0.00 0 0 0 2009-11-02 EC_BC.Z_Z 0.00 0 0 …
BgnR
  • 319
  • 1
  • 12
0
votes
1 answer

Eliminate the non repeating dates in R

I have 2 zoo series one of stock returns and the other of market returns. The thing is that my market return series contains holidays (example: 4 of July) and the stock series doesn't. I want to compare the dates of the 2 series and eliminate the…
0
votes
2 answers

R - Zoo - Dealing With Bad Entries

I'm trying to read a set of csv datasets into R as zoo time series. I've managed to convert the data into data frames with the index columns as dates and the rest as numeric vectors. I now need to convert these data frame into zoo. Here's the code…
user3294195
  • 1,748
  • 1
  • 19
  • 36
0
votes
0 answers

Populate multiconditional boolean R using vectors instead of for

This is the latest in my series "How to avoid for loops in R." I imagine at some point, I will get it. Below is the code, for the sake of this example, just run it with Strikes = 530. There is no need to test all the others and worry about the…
mks212
  • 901
  • 1
  • 18
  • 40
0
votes
0 answers

Better Way To Plot OHLC Minute Data From Imported csv in R

It took me quite a bit of time to get this to work, but I have plotted an OHLC chart for 1 minute timeframes for AAPL on 2/28/14 using the below function. The csv file can be downloaded here,…
mks212
  • 901
  • 1
  • 18
  • 40
0
votes
2 answers

Eliminating Existing Observations in a Zoo Merge

I'm trying to do a zoo merge between stock prices from selected trading days and observations about those same stocks (we call these "Nx observations") made on the same days. Sometimes do not have Nx observations on stock trading days and…
W Barker
  • 324
  • 2
  • 8
0
votes
1 answer

R - removing NA values

I have a big table in R with lots of NA values. The first lines: "tm1" "score1" "score2" "score3" "score4" "score5" "score6" "score7" "score8" "score9" "score10" "score11" "score12" "score13" "score14" "score15" "score16" "score17" "score18"…
dorien
  • 5,265
  • 10
  • 57
  • 116