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
-2
votes
1 answer

R: converting data frame to zoo: Error in as.matrix.data.frame(x)

I need to merge two time series, and it seems it's best to do it using merge.zoo. When I try to convert each of the two data frames to zoo, I get the following error: zoo(FNCC_short) Error in as.matrix.data.frame(x) : dims [product 10] do not…
user2069819
  • 53
  • 1
  • 5
-3
votes
1 answer

Correlation matrix between different zoo objects

I have a few files with zoo objects that look like this (each file starts and ends at different dates): code pp 1942-06-01 4016 0 1942-06-02 4016 NA 1942-06-03 4016 0 1942-06-04 4016 0 1942-06-05 NA 0 1942-06-06 NA …
sbg
  • 1,772
  • 8
  • 27
  • 45
-3
votes
1 answer

How to convert minute data to hourly data correctly in R?

Say I have the following sample minute data. > data = xts(1:12, as.POSIXct("2020-01-01")+(1:12)*60*20) > data [,1] 2020-01-01 00:20:00 1 2020-01-01 00:40:00 2 2020-01-01 01:00:00 3 2020-01-01 01:20:00 4 2020-01-01…
MichaelE
  • 763
  • 8
  • 22
-3
votes
1 answer

Can I merge a time series iteratively in a loop?

I'm trying to merge zoo classes within a loop, accumulating zoo series as new 'columns' with each iteration. I initialize an empty zoo() prior to running the loop. After my code completes, I get 'zoo series without observations' when I call str() on…
StatsViaCsh
  • 2,600
  • 10
  • 44
  • 63
-4
votes
2 answers

How to use the write.table function in R?

I am trying to save an object to a text file with the command write.table(ESH2, "c:/ESH2.txt", sep=","). The problem is that the saved time series doesn't contain date and time values that I downloaded. I used the package twsInstrument and the…
Joe Joeansjen
  • 75
  • 1
  • 2
  • 6
-5
votes
1 answer

Converting factor YYYY/MM to year-month class

I have dataframe with a column of dates of the form YYYY/MM, factor class, and I wish to convert it to date class. E.g. 2000/01 -> Jan 2000 I note that as.Date() is unable to handle date formats without the day component. I have tried using the…
-6
votes
1 answer

Conversion of a data into time series object

I have a file and I want to perform time series analysis on the data.Unfortunately I am unable to convert data into time series object? Here is the snapshot of the code: I have two column timestamp and closing price.I have tried various code but…
cmpunk
  • 15
  • 3
-6
votes
2 answers

Syntactical Issue in R

I have a zoo object in R of percent changes. I would like to compound those percent changes starting from 1 or 100 and see if we have compounded expansion/decay. Lines <- "obs date pctchng comgrowth 1 2010-10-04 NA 100 2 …
gabriel
  • 399
  • 2
  • 7
  • 17
1 2 3
88
89