Displaying 20 results from an estimated 2000 matches similar to: "Select range of dates"
2017 Sep 11
4
Case statement in sqldf
Hi all,
I am trying to create a new variable called Fiscal Year (FY) using case expression in sqldf and I am getting a null FY , see the code below .
Please advise me as to how I can do this mutation.
library(zoo)
library(lubridate)
library(stringr)
library(RH2)
library(sqldf)
cr$ReportDate = as.Date(cr$ReportDate, format ='%Y-%m-%d')
> cr2 = sqldf(" select
2017 Sep 11
0
Case statement in sqldf
2018-03-3 in your code should be 2018-03-31.
The line
then'201415'
needs to be fixed.
When posting please provide minimal self-contained examples. There was
no input provided and library statements not relevant to the posted
code were included.
Fixing the invalid date and bad line, getting rid of those library
statements that are unnecessary and providing some test input, it
works
2006 May 01
4
efficiency in merging two data frames
I have two data sets about lots of companies' stock
and fiscal data. One is monthly data with about
144,000 lines, and the other is quaterly with about
56,000. Each data set takes different company code.
I need to merge these two together. I read both ask
cvs. And the other file with corresponding firm code.
Now I have three data sets. return$PERMNO,
account$GVKEY. id is the data frames
2012 Apr 18
2
quarter end dates between two date strings
Hello,
I have two date strings, say "1972-06-30" and "2012-01-31", and I'd like to
get every quarter period end date between those dates? Does anyone know how
to do this? Speed is important...
Here is a small sample:
Two dates:
"2007-01-31"
"2012-01-31"
And I'd like to get this:
[1] "2007-03-31" "2007-06-30"
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.
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
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
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
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 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
2009 Aug 25
3
NET USE ?
Hi,
I'm trying to access a remote fiscal printer under Wine. I'm wondering if it's possible to use the 'net use' command from Windows (but under wine) to map the remote printer or if it's possible to simple mount the remote printer (dunno how as mount.cifs gives no clue about how to mount print shares) under 'dosdevices/unc'
anyone ?
Thanks in advance.
Ricardo
2013 Mar 01
7
Conditional Weighted Average (ddply or any other function)
Hello R community,
I am computing weighted average statistic by using ddply function:
My data set is:
N1 T1 S1 I1 C1 FY-4 ROE11 EPS11 MKT11
N1 T1 S1 I1 C1 FY-3 ROE12 EPS12 MKT12
N1 T1 S1 I1 C1 FY-2 ROE13 EPS13 MKT13
N1 T1 S1 I1 C1 FY-1 ROE14 EPS14 MKT14
N1 T1 S1 I1 C1 FY0 ROE15 EPS15 MKT15
N1 T1 S1 I1 C1 FY1 ROE16 EPS16 MKT16
N1 T1 S1 I1 C1 FY2 ROE17
2009 May 04
4
Creating a variable which is the sum of equal rows in a dataframe
Hi everyone:
I need to count the number of banks of each firm in my
data. The firm is identified by the fiscal number. The
banks of each firm appears like this:
Firm Banks
500600700 Citybank
500600700 CGD
500600700 BES
500600800 Citybank
500600800 Bank1
500600900 CGD
I want to obtain the following dataframe:
Firm
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
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 Apr 16
1
Matching Problem: Want to match to data.frame with inexact matching identifier (one identifier has to be in the range of the other).
Hello R-Community,
I have the following matching problem: I have two data.frames, one
with an observation every month (per company ID), and one with an
observation every quarter (per company ID; note that quarter means
fiscal quarter; therefore 1Q = Jan, Feb, Mar is not necessarily
correct and also, a fiscal quarter is not necessarily 3 month long).
For every month and company, I want to get the
2009 Sep 17
3
Help with date specification
Hi everyone,I have a data daily data (x) for 10 years starting from
04-01-1995 to 03-31-2005.
I was able to get the yearly sum for the ten years using
aggregate(x, years, sum).
But this gave me the yearly sum for 1995 (Apr- Dec); 1996 (Jan-Dec)
---------2005 (Jan-Mar).
But I want to get the aggregates for Apr-1995 to Mar 1996, Apr 1996- mar
1997 and so on.
your help will be higly appreciated.
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