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

Creating a time offset for a zoo object

I have a zoo object that contains velocity data from two different points (V1 and V2), as well as particle Data from the same two points. The distance between the two points is 170m. Date<- as.POSIXct("2012-01-01 08:00:00") +…
Vinterwoo
  • 3,843
  • 6
  • 36
  • 55
0
votes
1 answer

How to sort by year and month in R (using as.yearmon from zoo package)

I'm trying to sort a vector with year and month information. I'm getting year and month from a Date type variable. Here's an example of what I'm trying to accomplish: example <- as.Date(c("2010-04-22", "2010-04-26", "2010-04-26", "2010-06-04",…
Manoel Galdino
  • 2,376
  • 6
  • 27
  • 40
0
votes
1 answer

Convert modified julian date to UTC

I have a large file with about 200000 lines and I'd like to get the file in a way that I can use the zoo package to plot the file and to truncate by date,month and time. The first column is the modified julian date and the second is temperature. I'd…
user1513007
  • 49
  • 1
  • 3
0
votes
1 answer

Alternate y axes using zoo.plot in R

I am using zoo.plot to plot a multiple, stacked plot with 4 y axes over 1 x axis. Is there a way alternate the side of the y axis labelling and tick marks so they dont overlap on the same side. i.e. top plot, the y axis is on the left, next plot its…
Jojo
  • 4,951
  • 7
  • 23
  • 27
0
votes
1 answer

Iterating through vector: replacement has length zero

I am trying to iterate through a vector and edit a new one however I keep getting the error replacement has length zero. The portion where the error occurs is here: NewPos1 = rep(NROW(sig_decision)) for( i in 2:length(NewPos)) { NewPos1[i] =…
Rtrader
  • 917
  • 4
  • 11
  • 26
0
votes
1 answer

Duplicate indexes ONLY after call to zoo object column

Basically, I have a zoo object indexed by a concatenated POSIXct date/time object. Everything looks fine, but when I make the call: zoo$Close The column returned shows a duplicate of indices and prices. I bet it has something to do with the…
0
votes
2 answers

making time series regular

I this time series data( I am not able to dput. Because dput give a very long result, copying and pasting it here will make a mess) These are few lines from my text file: Time Depths ifc if lat lon "7814"…
rockswap
  • 623
  • 1
  • 7
  • 17
0
votes
1 answer

R - zoo plots customization

I have data in a zoo object which has multiple columns. Now I want to plot (four of those columns) two columns in same and two in graph below the previous graph. To be more precise, I have been able to plot the four of them one below the other.…
shoonya
  • 292
  • 1
  • 10
-1
votes
1 answer

How to create a time series array

I have a few hundred data files, each comprising of a 3 line header and a single column of sampled data values. In the header there is are multiple fields including a time field which gives the time the file was created e.g. "Time=10:00:00.156",…
-1
votes
1 answer

lm() on zoo:rollapply() gives odd result

I have some data: > xt2 # A tibble: 5 x 3 # Groups: symbol [1] symbol wavgd1 rowNo 1 REGI 4.84 2220 2 REGI 0.493 2221 3 REGI -0.0890 2222 4 REGI 0.190 2223 5 REGI -1.93 2224 which, when I process…
Ian
  • 1,507
  • 3
  • 21
  • 36
-1
votes
1 answer

R: index entries in ‘order.by’ are not unique (Zoo)

I am pulling financial data in and trying to output it with shiny. I am not familiar with zoo functions. In attempt to make positive returns green, and negative returns, red, I am receiving the following error: Warning in zoo(cd, order.by =…
jfinneg9
  • 11
  • 1
-1
votes
1 answer

rollapplyr on missing records related by date

How do I apply rollapplyr on the following data to allow it be sensitive to the date field? Because currently I am able to apply the rolling (blind to the date) over the dataset with eg. 4-quarters period and minimum of 2 observations in the 4…
yeeen
  • 4,911
  • 11
  • 52
  • 73
-1
votes
1 answer

R: Parse date as year/quarter

I have a dataframe that looks like this Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 344479 obs. of 6 variables: $ REGION : chr "NSW1" "NSW1" "NSW1" "NSW1" ... $ SETTLEMENTDATE: POSIXct, format: "1998-12-07 02:00:00" "1998-12-07 02:30:00"…
Davide Lorino
  • 875
  • 1
  • 9
  • 27
-1
votes
1 answer

Using zoo package

Please help! I have a .csv file with 4 columns: Date, VBLTX, FMAGX and SBUX. The three latter columns are adjusted closing prices of some stocks. And the date column are the months from Jan-1998 to Dec-2009. Here is the first couple or rows: Date …
-1
votes
1 answer

Sub-setting to find the anomaly

In a data frame, I am trying to look for data points that are more than (threshold * s.d.) away from mean. The dim of the data frame is as follows: [1] 4032 4 To find the data points for the above condition, I did: df$mean = rollapply(df$value,…
Jatt
  • 665
  • 2
  • 8
  • 20