Displaying 20 results from an estimated 11000 matches similar to: "quarter end dates between two date strings"
2008 May 31
1
Representing 'Date' as 'Year - Quarter'
I have financial data on a a set of firms, with a quarterly period
(fundamental data). The data spans 10 years, and four quarters per
year. The present file (.csv) reads the Date columns as "200706" for
the second quarter of 2007; "199809" for the third quarter of 1997.
Is there a way I can convert it to something like "2007 Q2", "1998 Q3"?
I am aware of
2006 Feb 17
3
(Newbie) Functions on vectors
Folks,
I want to make the following function more efficient, by vectorizing it:
getCriterionDecisionDate <- function (quarter , year)
{
if (length(quarter) != length(year)) stop ("Quarter and year vectors
of unequal length!");
ret <- character(0);
for (i in 1:length(quarter)) {
currQuarter <- quarter[i];
currYear <- year[i];
if ((currQuarter < 1) |
2006 Oct 08
2
Select range of dates
Hello,
This is likely fairly silly question, and I apologize to whomever takes the
time to respond.
I am a relatively new user of R, on Windows XP, version 2.3.1.
Say I have a data table that looks like the following:
x
Date Location Amount Blue Green
1 01/01/2001 Central 1817 TRUE FALSE
2 01/02/2001 Central 20358 FALSE TRUE
3 05/08/2001 Central 16245 FALSE TRUE
4
2010 Jan 16
3
Comparing dates in dataframes
I have two data frames. One (arr) has all arrivals to an airport for a
year, and the other (gw) has the dates and quarter hour of the day when
the weather is good. arr has a Date and quarter hour column.
>names(arr)
[1] "Date" "weekday" "hour" "month" "minute"
[6] "quarter" "ICAO"
2007 Jul 25
3
aggregate.ts
Consider the following scrap of code:
> x<- ts(1:50,start=c(1,11),freq=12)
> y <- aggregate(x,nfreq=4)
> c(y)
[1] 6 15 24 33 42 51 60 69 78 87 96 105 114 123 132 141
> y
Error in rep.int("", start.pad) : invalid number of copies in rep.int()
> tsp(y)
[1] 1.833333 5.583333 4.000000
So we can aggregate into quarters, but we cannot print it using
2007 Jul 25
3
aggregate.ts
Consider the following scrap of code:
> x<- ts(1:50,start=c(1,11),freq=12)
> y <- aggregate(x,nfreq=4)
> c(y)
[1] 6 15 24 33 42 51 60 69 78 87 96 105 114 123 132 141
> y
Error in rep.int("", start.pad) : invalid number of copies in rep.int()
> tsp(y)
[1] 1.833333 5.583333 4.000000
So we can aggregate into quarters, but we cannot print it using
2010 Oct 25
3
finding the year of a date
I know that I can use as.yearmon in the package "zoo" to find the year
and the month of a date.
I can use as. yearqtr to find the year and the quarter.
But how can one find just the year of a date?
Thanks a lot!
--
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com
2009 Sep 13
3
How to get last day of a month?
Is there any R function to calculate automatically the last day of a
particular month? For example "sep2009" should be converted to last day of
September of 2009?
Thanks
--
View this message in context: http://www.nabble.com/How-to-get-last-day-of-a-month--tp25425645p25425645.html
Sent from the R help mailing list archive at Nabble.com.
2010 Jan 20
1
Line Plot with Dates on X-axis
I am trying to generate a line graph with quarterly time buckets (with
nice labels) on the x-axis. The first block of code below will
generate the graph with nicely formatted x-axis labels, but the
"type=" and "col=" options are not recognized when factors are used
for the x-axis.
The second block, where the quarter values are mapped into dates, will
plot the line nicely but
2010 Jan 18
3
Using the output of strsplit
I successfully combined my data frames, and am now on my next hurdle.
I had combined the data and quarter, and used tapply to count the
entries for each unique date/quarter pair.
ar= tapply(ewrgnd$gw, list(ewrgnd$dq), sum) #for each date/quarter
combination sums the gw (which are all 1)
dq=row.names(ar)
spl=strsplit(dq)
But I need to split them back into the separate date and quarter. So I
used
2012 Apr 11
2
What is a better way to deal with lag/difference and loops in time series using R?
Hello,
I am writing codes for time series computation but encountering some
problems
Given the quarterly data from 1983Q1 to 1984Q2
PI1<-ts(c(2.747365190,2.791594762, -0.009953715, -0.015059485,
-1.190061246, -0.553031799, 0.686874720, 0.953911035),
start=c(1983,1), frequency=4)
> PI1
Qtr1 Qtr2 Qtr3 Qtr4
1983 2.747365190 2.791594762
2010 Feb 01
3
merging data frames gives all NAs
Dear kind R helpers,
I have a vector of runway names in rwy ("31R", "31L",... the number is
user selectable)
arrgnd is a data frame with data for all flights and all runways, with a
Runway column.
I am trying to subset arrgnd into a dat frame for each selected runway,
and then combine them back together using the following code:
for (j in 1:nr) { # nr = number of
2018 Jan 28
2
Plotting quarterly time series
I have a data set with quarterly time series for several variables. The
time index is recorded in column 1 of the dataframe as a character vector
"Q1 1961", "Q2 1961","Q3 1961", "Q4 1961", "Q1 1962", etc. I want to
produce line plots with ggplot2, but it seems I need to convert the time
index from character to date class. Is that right? If so, how
2010 Jun 08
2
Extract/format/show for S4 objects
Hi all,
I'm trying to make an integer-backed quarter (as in fraction of year)
class, but I can't quite it to work. I want integer-backed so I don't
have to worry about floating-point effects when doing math, and so that
I can use it as in data.table.
First of all, is there a good reference for this anywhere? All of the
S4 tutorials that I've found have been too high-level, and
2008 Jun 29
1
Calculating quarterly statistics for time series object
I have time series observation on daily frequencies :
library(zoo)
SD=1
date1 = seq(as.Date("01/01/01", format = "%m/%d/%y"), as.Date("12/31/02", format = "%m/%d/%y"), by = 1)
len1 = length(date1); data1 = zoo(matrix(rnorm(len1, mean=0, sd=SD*0.5), nrow = len1), date1)
plot(data1)
Now I want to calculate 1. Quarterly statistics like mean, variance etc
2008 Sep 11
3
Truncating dates (and other date-time manipulations)
Dear all,
I've been struggling to perform common operations on dates that I need
to be able to correct draw date-time scales - in particular I need to
be able to round/truncate/ceiling dates to arbitrary precision - e.g.
to weeks, months or years (or multiples thereof). I haven't been able
to find anything to do this in base R (trunc.Date only truncates to
sub-day units), or in the date
2009 Jan 08
1
Convert to as.Date
Hi,
I have an vector object that looks like
DA <- c("1991q1", "1993q2")
(first quarter of 1991 etc) and I want to convert it into a date object
using as.Date(). I did this for montly data but am stumped when it comes to
dealing with quarterly data and as.Date.
Would anyone be able to help? Would be very grateful for any advice, sorry
for being such an R-newbie!
2018 Jan 28
0
Plotting quarterly time series
On Sun, 28 Jan 2018, phil at philipsmith.ca wrote:
> I have a data set with quarterly time series for several variables. The
> time index is recorded in column 1 of the dataframe as a character
> vector "Q1 1961", "Q2 1961","Q3 1961", "Q4 1961", "Q1 1962", etc. I want
> to produce line plots with ggplot2, but it seems I need to
2018 Jan 28
1
Plotting quarterly time series
Using Achim's d this also works to generate z where FUN is a function used
to transform the index column and format is also passed to FUN.
z <- read.zoo(d, index = "time", FUN = as.yearqtr, format = "Q%q %Y")
On Sun, Jan 28, 2018 at 4:53 PM, Achim Zeileis <Achim.Zeileis at uibk.ac.at> wrote:
> On Sun, 28 Jan 2018, phil at philipsmith.ca wrote:
>
>> I
2008 Aug 15
2
Design-consistent variance estimate
Dear List:
I am working to understand some differences between the results of the
svymean() function in the survey package and from code I have written
myself. The results from svymean() also agree with results I get from
SAS proc surveymeans, so, this suggests I am misunderstanding something.
I am never comfortable with "I did what the software" does mentality, so
I am working to