I am already using that to combine the date and time (I had it in the code, but took it out for the post to simplify it), but I still have the problem where I want to remove any time before 6am across all dates.
-----Original Message----- From: cl...@ecy.wa.gov [mailto:cl...@ecy.wa.gov] Sent: Tuesday, May 10, 2011 10:15 AM To: Thompson, Adele - adele_thomp...@cargill.com Cc: r-help@r-project.org Subject: Re: [R] need to delete by time, not date You may be happy using: strptime(paste(Date,Time,sep=" "),"%m/%d/%y %H:%M")$hour -- Clint Bowman INTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE: (360) 407-6815 PO Box 47600 FAX: (360) 407-7534 Olympia, WA 98504-7600 USPS: PO Box 47600, Olympia, WA 98504-7600 Parcels: 300 Desmond Drive, Lacey, WA 98503-1274 On Tue, 10 May 2011, Schatzi wrote: > I have a matrix where one column has a date and another column has a time. I > need to delete all times before 6am. I had combined the Date and Time column > into DateTime. > > Mat1: > Weight Date Time > 7.6 04/28/11 09:03 > 8.4 04/29/11 03:11 > 8.6 04/29/11 05:32 > 8.6 04/29/11 09:53 > 1.4 05/01/11 19:52 > > I tried just picking up the time: > > as.POSIXct(Mat1$Time, format = "%H:%M") > > but this assigns the time value today's date. > > The final matrix should look like: > Weight Date Time > 7.6 04/28/11 09:03 > 8.6 04/29/11 09:53 > 1.4 05/01/11 19:52 > > > ----- > In theory, practice and theory are the same. In practice, they are not - > Albert Einstein > -- > View this message in context: > http://r.789695.n4.nabble.com/need-to-delete-by-time-not-date-tp3512162p3512162.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.