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

Setting the language of time axes of a zoo object in R

I'm working on a zoo object in R containing a financial time series and wanted to plot it. By using the simple command plot(zoo_obj) a plot is automatically created as in the figure below. How to choose the language of the x-axis? Here the x-axis…
Lorenzo Rigamonti
  • 1,705
  • 8
  • 25
  • 36
0
votes
0 answers

MySQL Query and POSIXct in Loop

I have the following MySQL Query using RMySQL. All the Database parameters are set before and Query is working well. Is there a possibility to put it in a loop to get multiple zoo objects from more than one dpname?…
Herr Student
  • 853
  • 14
  • 26
0
votes
0 answers

Period apply in xts - column max

Is there any funktion like colMeans to get the maximum of the day e.g. colMax? period.apply(df.xts, endpoints(df.xts, "days", 1), colMeans) Or are there any other solutions? Thanks
Herr Student
  • 853
  • 14
  • 26
0
votes
0 answers

Converting a csv to an xts using QuantQuote Data

I know that there are other similar posts, but I still couldn't figure out how to coerce the data I had to an XTS object. https://quantquote.com/sample/SPY_MINUTE_TRADE.csv contains a csv file of minute bar data of the SPY. Column 1 is Data in…
DolemiteMofo
  • 39
  • 1
  • 6
0
votes
0 answers

What does by.column parameter in rollapply do?

I have read the document, but can't figure it out. Suppose there are data like below: x=matrix(1:60,nrow=10) x [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1 11 21 31 41 51 [2,] 2 12 22 32 42 52 [3,] 3 13 23 33 43…
ChaoYang
  • 837
  • 2
  • 8
  • 14
0
votes
2 answers

R: Coverting a data frame in a wide format to a long format

I have some data in a wide format. How do I convert the data in the long format? Input would look like as given below: > require("FRBData") > curve.wide <- GetInterestRates("TCMNOM", lastObs = 5) > curve.wide 1M 3M 6M 1Y 2Y 3Y…
user3212376
  • 237
  • 1
  • 4
  • 12
0
votes
1 answer

Using rollapply on data set with 30 columns

I'm very new to R and are trying to get the means of gene expression data set. The files is a csv file and is has 185 rows (gene names) and 30 columns (time points in triplicates). I use the following commands to import the csv. file into…
0
votes
1 answer

lenght of columns of two objects when more than one column in one object is present

I have the following vector and acf function (packages quantmod,XML,zoo) L<- 1 theurl <- "http://www.iasg.com/groups/group/transtrend/program/transtrend-diversified- trend-program-enhanced-risk-usd" tables <- readHTMLTable(theurl) n.rows <-…
Barnaby
  • 1,472
  • 4
  • 20
  • 34
0
votes
1 answer

R - rollapply with reverse window

I have a matrix (V) with daily stock returns between a certain time period on which I try to get the variance of the preceding 1-month (=21 days) and 6-months (=126 days). This is how I would do it based on future 1-month and 6-months…
0
votes
1 answer

R - no documentation for .fill_short_gaps

I was looking at the R source codes for the zoo package (who many functions are extremely useful). I noticed a function .fill_short_gaps used quite a lot, but I can't find any documentation for this either in the zoo source codes or in the base…
uday
  • 6,453
  • 13
  • 56
  • 94
0
votes
2 answers

How to create a monthly time series with missing years?

I have monthly data frame(stn) which I want convert into a single column (date vs rain) time series zoo object as it is with missing years. I would like to do few analysis with zoo package. Any help? > head(stn) Year Jan Feb Mar Apr May…
Fredrick
  • 37
  • 6
0
votes
1 answer

How to limit aggregation of daily value into monthly and annual totals?

I have a zoo object(stn) of long records of daily data (date Vs rain). I have used hydoTSM package (m <- daily2monthly(stn, FUN=sum,na.rm=TRUE)) which works fine but I want to allow aggregation only for months with at least 20 daily records. For…
Fredrick
  • 37
  • 6
0
votes
3 answers

How to list daily maximum rainfall value for different year?

I have daily time series data (date Vs rainfall). I would like to list maximum daily rainfall for each year (27 years). With which.max i can return only one daily max rainfall value for the whole (27 years) time series. Can anybody suggest a better…
Fredrick
  • 37
  • 6
0
votes
2 answers

Calculate realized monthly values by quarter

I'm stuck with a little R-problem. Let's assume I have a zoo data set that is structured as follows: df<-data.frame(r1=rnorm(25), r2=rnorm(25)) df<-zoo(df, as.Date(seq(from=as.Date("1980-01-01"), to=as.Date("1983-02-01"), by="1 month"))) I would…
PMaier
  • 592
  • 7
  • 19
0
votes
0 answers

value lost when read.zoo

I tried to read my data as zoo using read.zoo function, the data include 14436 columns and the first column is in date format (yyyy-mm-dd). My code is HFs<-read.zoo("F:/Research/Drawdown analysis/Data analysis/HF…