Hi Raghu,
Using the example you provided. If you want Q3 for year 2011 and 2013.
dat[grep("2011 Q3|2013 Q3", Qtr1),] #change accordingly
#??? ID Phase RESEARCH Area????? Date?? Result
#1? 100??? IV?? S_Care? A&P 7/23/2013 Positive
#5 2005??? IV??? Speci?? TH? 8/4/2011???? <NA>
#6 2006?? III??? Speci?? BN 7/13/2011 Positive
A.K.
Thanks a lot for the reply Arun.
I would like to pull the quarter for that particular year. say i want Q2 for
year 2014 r Q2 for year 2013.
You assistance is very much appreciated.
Thanks Raghu
On Wednesday, June 11, 2014 10:19 AM, arun <smartpink111 at yahoo.com>
wrote:
Hi,
Please Check ?as.yearqtr() fromlibrary(zoo)
dat <- read.table(text="ID? Phase RESEARCH Area?? Date Result
100?? IV???????? S_Care A&P 7/23/2013 Positive
1001?? IV???????? P_Care EU 12/20/2012 Positive
2001?? IV???????? Car??????? AS 9/13/2012 Positive
20003?? III???????? Spec???? IN 10/6/2011 NA
2005??? IV???????? Speci?? TH 8/4/2011 NA
2006? III???????? Speci???? BN 7/13/2011 Positive
21345? II???????? Pri???? HY 2/3/2011
Positive",sep="",header=TRUE,stringsAsFactors=FALSE)
library(zoo)
Qtr1 <- as.yearqtr(dat$Date, format="%m/%d/%Y")
dat[grep("Q3",Qtr1),]
#??? ID Phase RESEARCH Area????? Date?? Result
#1? 100??? IV?? S_Care? A&P 7/23/2013 Positive
#3 2001??? IV????? Car?? AS 9/13/2012 Positive
#5 2005??? IV??? Speci?? TH? 8/4/2011???? <NA>
#6 2006?? III??? Speci?? BN 7/13/2011 Positive
A.K.
Hi ,
I have a dataset as below,
ID? Phase RESEARCH Area?? Date Result
100?? IV???????? S_Care A&P 7/23/2013 Positive
1001?? IV???????? P_Care EU 12/20/2012 Positive
2001?? IV???????? Car??????? AS 9/13/2012 Positive
20003?? III???????? Spec???? IN 10/6/2011 NA
2005??? IV???????? Speci?? TH 8/4/2011 NA
2006? III???????? Speci???? BN 7/13/2011 Positive
21345? II???????? Pri???? HY 2/3/2011 Positive
I would like to pull data based on the Quarter, for example say if i want data
for 3rd quarter based on the date column how do i do it.
I tried the lubridate package but was not able to get the required result.
can any one of you assist me on this.
Your help is very much appreciated.