similar to: How to create sequence in month

Displaying 20 results from an estimated 30000 matches similar to: "How to create sequence in month"

2011 Apr 06
2
A zoo related question
Dear all, please consider my following workbook: library(zoo) lis1 <- vector('list', length = 2) lis2 <- vector('list', length = 2) lis1[[1]] <- zooreg(rnorm(20), start = as.Date("2010-01-01"), frequency = 1) lis1[[2]] <- zooreg(rnorm(20), start = as.yearmon("2010-01-01"), frequency = 12) lis2[[1]] <- matrix(1:40, 20) lis2[[2]] <-
2009 Sep 25
3
Problem on plotting TS using GGPLOT
Hi, I have following codes : library(zoo); library(ggplot2); library(plyr) dat <- rnorm(306); vv <- letters[1:6]; dat1 <- data.frame(dat, vv) dat2 = zooreg(rnorm(51), as.yearmon(as.Date("2000-01-01")), frequency=12) ggplot(dat1) + geom_line(aes(y=dat, x=index(dat2), colour=vv), group=vv, size = 1.3) However I got error while plotting them :
2010 Jul 10
7
Need help on date calculation
Hi all, please see my code: > library(zoo) > a <- as.yearmon("March-2010", "%B-%Y") > b <- as.yearmon("May-2010", "%B-%Y") > > nn <- (b-a)*12 # number of months in between them > nn [1] 2 > as.integer(nn) [1] 1 What is the correct way to find the number of months between "a" and "b", still
2010 Jul 07
3
Need help in handling date
Dear all, I have a date related question. Suppose I have a character string "March-2009", how I can convert it to a valid date object like as.yearmon("2009-01-03") in the zoo package? Is there any possibility there? Ans secondly is there any R function which will give the names of of all months as "LETTERS" does? Thanks for your time. [[alternative HTML version
2010 Apr 08
2
Meaning of "lag 0.2, 0.4,..." ?
Please see that correlogram for a arbitrary time series : acf(zooreg(rnorm(39), start=as.yearmon("2008-01-01"), frequency=12)) What is the meaning of lag 0.2, 0.4, ........ in the plot? Those should not be integers? Or I am missing something? Thanks -- View this message in context: http://n4.nabble.com/Meaning-of-lag-0-2-0-4-tp1765093p1765093.html Sent from the R help mailing list
2009 Jul 01
1
A problem on zoo object
I have a zoo object on daily data for 10 years. Now I want to create a list, wherein each member of that list is the monthly observations. For example, 1st member of list contains daily observation of 1st month, 2nd member contains daily observation of 2nd month etc. Then for a particular month, I want to divide all observations into 3 parts (arbitrary) and then want to calculate some statistics
2009 Sep 24
2
Downloading data from from internet
Hi all, I want to download data from those two different sources, directly into R : http://www.rateinflation.com/consumer-price-index/usa-cpi.php http://eaindustry.nic.in/asp2/list_d.asp First one is CPI of US and 2nd one is WPI of India. Can anyone please give any clue how to download them directly into R. I want to make them zoo object for further analysis. Thanks, -- View this message in
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
2013 Mar 09
4
Calculation with date
Hello again, Let say I have an non-negative integer vector (which may be random): Vec <- c(0, 13, 10, 4) And I have a date: > Date <- as.Date(Sys.time()) > Date [1] "2013-03-09" Using these 2 information, I want to get following date-vector: New_Vec <- c("2013-03-01", "2014-04-01", "2014-01-01", "2013-07-01") Basically the
2010 Nov 23
2
Plot two zoo object with different indexes
Dear R community, I have the following two zoo objects: MONTHLY CPI > plot(z) > par("usr") [1] 1977.76333 2011.15333 70.39856 227.03744 > z=zooreg(cpius$Value,as.yearmon("1979-11"),frequency=12) > str(z) ?zooreg? series from Nov 1979 to Oct 2010 Data: num [1:372] 76.2 77 77.8 78.5 79.5 80.3 81.1 82 82 82.6 ... Index: Class 'yearmon' num [1:372]
2012 Dec 10
1
Can somebody suggest how to achieve following data manipulation?
Dear all, Let say I have following data: RawData <- matrix(1:101, nr = 1); colnames(RawData) <- c("ASD", as.character(as.yearmon(seq(as.Date("2012-03-01"), length.out = 100, by = "1 month")))); rownames(RawData) <- "XYZ" CutOffDate <- as.Date("2012-09-01") NewDateSeries <- as.character(as.yearmon(seq(CutOffDate, to =
2011 May 19
1
Creating a "shifted" month (one that starts not on the first of each month but on another date)
Hello! I have a data frame with dates. I need to create a new "month" that starts on the 20th of each month - because I'll need to aggregate my data later by that "shifted" month. I wrote the code below and it works. However, I was wondering if there is some ready-made function in some package - that makes it easier/more elegant? Thanks a lot! # Example data:
2017 Aug 10
3
Zoo rolling window with increasing window size
Hi Joshua, thanks for your prompt reply. However as I said, sum() function I used here just for demonstrating the problem, I have other custom function to implement, not necessarily sum() I am looking for a generic solution for above problem. Any better idea? Thanks, On Fri, Aug 11, 2017 at 12:04 AM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote: > Use a `width` of integer index
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 =
2011 Jan 11
5
A question on dummy variable
Dear all, I would like to ask one question related to statistics, for specifically on defining dummy variables. As of now, I have come across 3 different kind of dummy variables (assuming I am working with Seasonal dummy, and number of season is 4): > dummy1 <- diag(4) > for(i in 1:3) dummy1 <- rbind(dummy1, diag(4)) > dummy1 <- dummy1[,-4] > > dummy2 <- dummy1 >
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
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
2017 Aug 10
2
Zoo rolling window with increasing window size
Hi again, I am wondering there is any function for 'zoo' time series, where I can apply a user defined function rolling window basis, wherein window size is ever increasing i.e. not fixed. For example, let say I have below user defined function and a zoo time series : > library(zoo) > UDF = function(x) sum(x) > TS = zoo(rnorm(10), seq(as.Date('2017-01-01'),
2017 Aug 10
0
Zoo rolling window with increasing window size
Replace "sum" with your custom function's name. I don't see any reason why that wouldn't work, and the problem with my solution is not clear in your response. r <- rollapplyr(x, seq_along(x), yourCustomFunctionGoesHere) On Thu, Aug 10, 2017 at 1:39 PM, Christofer Bogaso <bogaso.christofer at gmail.com> wrote: > Hi Joshua, thanks for your prompt reply. However
2018 Apr 24
2
Rolling window difference for zoo time series
Hi, I have a 'zoo' time series as below : Zoo_TS = zoo(5:1, as.Date(Sys.time())+0:4) Now I want to calculate First order difference of order 1, rolling window basis i.e. (Zoo_TS[2] - Zoo_TS[1] ) / Zoo_TS[1] (Zoo_TS[3] - Zoo_TS[2] ) / Zoo_TS[2] ..... Is there any direct function available to achieve this? Thanks,