On 29.11.2012 17:37, arun wrote:
Hi,

You haven't given any example dataset.  So,not sure about the format of the 
date column.
set.seed(5)
dat1<-data.frame(Date1=c("10/25/2009","11/25/2009","12/25/2009","5/10/2010","8/10/2010","9/25/2011","11/28/2011","5/3/2012"),col2=sample(1:15,8,replace=TRUE))
dat1$Date1<-as.Date(dat1$Date1,format="%m/%d/%Y") #change your date column 
format if it is not matching to this example.
dat2<-dat1[format(dat1$Date1,"%Y")!=2009,]
dat2
#       Date1 col2
#4 2010-05-10    5
#5 2010-08-10    2
#6 2011-09-25   11
#7 2011-11-28    8
#8 2012-05-03   13
A.K.


Or just use comparison operators on Date objects,
so it is also possible to specify arbitrary ranges.

Uwe Ligges







----- Original Message -----

From: siddanth911 <siddanth.srivast...@mu-sigma.com>
To: r-help@r-project.org
Cc:
Sent: Thursday, November 29, 2012 6:10 AM
Subject: [R] deleting data of a given date range.

hey,

I have a huge dataset with over 300000 rows which contains data about
something from 2009-2012. does anyone know how i can delete all the rows
which contain data from 2009 and only have data from 2010-2012???
is there a particular function i can use on the date column so that all data
from 2009 can be deleted???



--
View this message in context: 
http://r.789695.n4.nabble.com/deleting-data-of-a-given-date-range-tp4651272.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to