similar to: subset daily to monthly in a zoo or xts

Displaying 20 results from an estimated 7000 matches similar to: "subset daily to monthly in a zoo or xts"

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
2009 Dec 22
1
Using zoo() to aggregate daily data to monthly means
I am trying to get monthly means for a daily data series using zoo(). I have found an odd problem, that seems to be caused by zoo()'s handling of leap years. Here's my R script with 2 methods (freq=365, 366) for aggregating the daily data to monthly series: library(zoo) J_link <- "http://www.ijis.iarc.uaf.edu/seaice/extent/plot.csv" JAXA_data <- read.table(J_link,
2010 Apr 18
4
confused with yearmon, xts and maybe zoo
R-listers, I am using xts with a yearmon index, but am getting some inconsistent results with the date index when i drop observations (for example by using na.omit). The issue is illustrated in the example below. If I start with a monthly zooreg series starting in 2009, yearmon converts this to "Dec-2008". Not such a worry for my example, but strange. Having converted to xts, i drop
2017 Oct 06
2
Time series: xts/zoo object at annual (yearly) frequency
Hi, I'd like to make a time series at an annual frequency. > a<-xts(x=c(2,4,5), order.by=c("1991","1992","1993")) Error in xts(x = c(2, 4, 5), order.by = c("1991", "1992", "1993")) : order.by requires an appropriate time-based object > a<-xts(x=c(2,4,5), order.by=1991:1993) Error in xts(x = c(2, 4, 5), order.by =
2010 Apr 20
1
converting a zoo or an xts to a data frame
Dear R People: I have the following code that I use to convert a monthly zoo object to a data.frame, and it works perfectly: library(tseries) z <- get.hist.quote(instrument=inst1, start=start1,end=end1, quote=quot1,comp = "m") y <- as.ts(aggregate(z, as.yearmon, tail, 1)) y.df <- data.frame(y=y,time=time(y)) y.df$x <- ts(y.df[,1]) tsp(y.df$x) <-
2010 Apr 08
2
xts off by one confusion or error
Hullo I may have missed something blindingly obvious here. I'm using xts to handle some timeseries data. I've got daily measurements for 100 years. If I try to reduce the error rate by taking means of each month, I'm getting what at first sight appears to be conflicting information. Here's a small subset to show the problem: A small set of data: > vv x
2012 Feb 15
2
Control number of assets in resulting portfolio with optimizations using package fPortfolio
Dear All, I am using package fPortfolio to run minimum variance portfolio optimizations in R. I already know how to set portfolioSpecs, portfolio objects and constraints. Unfortunately I am not able to set the following type of constraints. I have a timeSeries object with returns data for roughly 1.5k assets for 261 subperiods (workingdays) and want to compute the global minimum variance
2009 Sep 25
0
differing behaviour between xts (0.6-7) and zoo (1.5-8)
Folks, I have some weekly dataseries that I convert to monthly xts (with yearmon indices), and obtain the two following extracts: > str(sig) An 'xts' object from Apr 1998 to Sep 1998 containing: Data: num [1:6, 1] 0.0083 0.2799 -0.2524 -0.0119 0.18 ... - attr(*, "dimnames")=List of 2 ..$ : NULL ..$ : chr "e1" Indexed by objects of class: [yearmon] TZ:
2011 Nov 28
1
Plotting a zoo object: lines and barplot
Dear R users, I have 3 columns in a zoo object. I want to plot all of them in one screen but I want the first two to be in "lines" format and 3rd one to be barplot. Regards Vikram [[alternative HTML version deleted]]
2009 Apr 15
2
From daily series to monthly and viceversa
I have the following daily exchange rate series (from january 1st 1996 to december 31st 2008) and I want to obtain them monthly series from it. I've read about the 'zoo' library but I'm not getting it how to do it. These are the data (left column day-month-year, right column the index) 31/12/1993 1,12509 03/01/1994 1,12509 04/01/1994 1,12558 05/01/1994 1,1258 06/01/1994 1,12596
2011 Sep 14
1
Strucchange generating breakpoints
Hi, I am new to R. I am using strucchange to get the breakpoints in time series dataset. So the problem I am facing is: I want to link the result generated by the breakpoints to further analysis (for eg. generating volatility for each group). The result is in following form: --------------------------------------- > res <- gbreakpoints(GDP.new ~ 1,data=a,h=2,breaks=6) > res
2012 Dec 07
2
Converting character to numeric: Error: (list) object cannot be coerced to type 'double'
Dear R users, I am facing a pretty a unusual problem while converting character to numeric. Any input would be appreciated. Below is the code and error faced: --------------------------------------- *> str(cmie.dts)* *'data.frame': 4397 obs. of 1 variable:* * $ INE001A01036: chr "1482181740.000000" "1482181740.000000" "1482181740.000000"
2011 Sep 21
1
Statmath-R-Forge: Request denied
Dear All, I want to subscribe for Statmath-R-Forge mailing list. But I am getting the following reply and I am unable to subscribe. Any insight on this would be appreciated. Regards Vikram Bahure __________ Your request to the Statmath-R-Forge mailing list Subscription request has been rejected by the list moderator. The moderator gave the following reason for rejecting your request:
2012 Feb 20
3
How to determine a subset of a binary strings?
Hi, I need some neat ways of determing a subset of binary strings. For example, x=c(0,0,1), y=c(0,1,1), z=c(0,1,0). So x is a subset of y and z is also a subset of y, but x is not a subset of z. I tried to search R functions and packages but no hits. Any ideas? Best, Jing -- Jing Tang, PhD Senior Researcher Finnish Institute of Molecular Medicine (FIMM) FI-00014 University of
2010 Jan 01
1
Chainging monthly data to daily data
Hi, I have a zoo object with monthly frequency : library(zoo) dat <- zooreg(rnorm(50), as.yearmon("2000-01-01"), frequency=12) Now I want to make a zoo object with daily frequency from "dat" wherein value for a each day for a particular month will be value of "dat" at that particular month. Is there any easy way to do that? Thanks, -- View this message in
2012 Jan 13
1
Portfolio Optimization
Hi, I'm an R newbie and I've been struggling with a optimization problem for the past couple of days now. Here's the problem - I have a matrix of expected payouts from different stock option strategies. Each column in my matrix represents a different stock and each row represents the return to the strategy given a certain market move. So the rows are not a time series of percentage
2009 Jan 23
1
extract certain months toyears (zoo)
Dear useRs and developeRs, In my diploma thesis I work with a daily time series of glacier runoff data. I did already aggregate them to monthly means etc. Now i want to use just the summer values (I am indecisive by now what that means, but let's make it easy and use months like June). Is there a way to extract the data off this zoo into another zoo with frequency=1 ? Do you have
2018 May 31
1
bracketing for optimize
dear R wizards: `optimize()` requires the user to provide the brackets. I can write a bracketing routine, given a function and a starting point, but I was wondering whether there was already a "standard" user-exposed implementation. (Presumably, this is used in nlm, too; alas, nlm is in C, not native R.) regards, /iaw
2011 Jul 22
2
Picking returns from particular days of the month from a zoo object
Hello, I would like to implement a "turn-of-the-month' trading strategy in R. Given a daily series of stock market return data as a zoo object, the strategy would go long (buy) four trading days before the end of the month, and sell the third trading day of the following month. How can I select these days, particularly the fourth day before and the third day after the turn of the
2013 Sep 01
1
Blur and not readable text, using geom_text in ggplot
Dear R Users, I am new to ggplot. I am using geom_text to inscribe values on my ggplot but it is giving me values which are unreadable and blur. Please let me know if there is any way out. ----------------- Code ----------------- *es <- es3 + geom_text(data=tmp.cor, aes(x=2, y=min(infer.df$value),* * label=text.bottom), colour="black",* *