Hi,all I only got the time data such as: tms<-c("19:30:23","18:39:10".....) I want to manipulate this time series data. For example, plus one second(or minute) or minus one second This data only has the time(h:m:s), without the date. I know that there are chron package, ISOPix class and the timeDate class, but all these class need the input of date. How can we manipulate the time data without the date? Thanks advance Ted -- View this message in context: http://www.nabble.com/How-to-manipulate-the-time-data-without-the-date--tp20365370p20365370.html Sent from the R help mailing list archive at Nabble.com.
Prof Brian Ripley
2008-Nov-06 17:29 UTC
[R] How to manipulate the time data without the date?
Why not give it an arbitrary date such 2008-01-01? On Thu, 6 Nov 2008, tedzzx wrote:> > Hi,all > > I only got the time data such as: > tms<-c("19:30:23","18:39:10".....) > > I want to manipulate this time series data. For example, plus one second(or > minute) or minus one second > > This data only has the time(h:m:s), without the date. I know that there are > chron package, ISOPix class and the timeDate class, but all these class need > the input of date.And in base R there is POSIXct.> How can we manipulate the time data without the date?Not really, as DST changes mean which day does matter. But all other days will be the same. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Gabor Grothendieck
2008-Nov-06 17:42 UTC
[R] How to manipulate the time data without the date?
On Thu, Nov 6, 2008 at 12:10 PM, tedzzx <zengzhenxing at gmail.com> wrote:> > Hi,all > > I only got the time data such as: > tms<-c("19:30:23","18:39:10".....) > > I want to manipulate this time series data. For example, plus one second(or > minute) or minus one second > > This data only has the time(h:m:s), without the date. I know that there are > chron package, ISOPix class and the timeDate class, but all these class need > the input of date.The chron package's times class does not have that restriction:> library(chron) > times("10:34:21")[1] 10:34:21
Does this help? library(chron) tms<-c("19:30:23","18:39:10") mytimes <- times(tms) mytimes[1]-mytimes[2] --- On Thu, 11/6/08, tedzzx <zengzhenxing at gmail.com> wrote:> From: tedzzx <zengzhenxing at gmail.com> > Subject: [R] How to manipulate the time data without the date? > To: r-help at r-project.org > Received: Thursday, November 6, 2008, 12:10 PM > Hi,all > > I only got the time data such as: > tms<-c("19:30:23","18:39:10".....) > > I want to manipulate this time series data. For example, > plus one second(or > minute) or minus one second > > This data only has the time(h:m:s), without the date. I > know that there are > chron package, ISOPix class and the timeDate class, but all > these class need > the input of date. > > How can we manipulate the time data without the date? > > Thanks advance > > Ted > --__________________________________________________________________ [[elided Yahoo spam]]