Re: [R] date and time coding question

2013-05-16 Thread Jeff Newmiller
I stand by my previous statement: you should avoid thinking of difftime objects as having units. At the point when you learn to regard the units argument as being associated with the numeric values you pass TO as.difftime or that you extract FROM a difftime object with as.numeric, then you will

Re: [R] date and time coding question

2013-05-16 Thread William Dunlap
,], points(day, as.numeric(alarm-sunrise, units="mins"), cex=2.5, pch=1, col="orange")) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Jeff N

Re: [R] date and time coding question

2013-05-16 Thread MacQueen, Don
The difftime() function has a units argument, so it seems kind of obvious to me to think of objects of class 'difftime' as having units. And indeed they do, stored as an attribute: > str(difftime( Sys.time()+3700, Sys.time(), units='min')) Class 'difftime' atomic [1:1] 61.7 ..- attr(*, "units")

Re: [R] date and time coding question

2013-05-15 Thread Jeff Newmiller
The difference of two POSIXct values is of type difftime. You should not think of difftime as having units. Rather, you should think of the result of converting from difftime to numeric (using as.numeric) as the opportunity (or rather requirement) to specify what time units you want. If you let

Re: [R] date and time coding question

2013-05-15 Thread MacQueen, Don
I think you probably want format='%m/%d/%y %H:%M') (lower case "y") diff() as suggested by Jeff Newmiller is good, except that I don't know how to control the units using diff(). ## so a method that allows specifying units other than hours would be, for example, datetime <-c("1/1/13 00:00","

Re: [R] date and time coding question

2013-05-10 Thread Jeff Newmiller
a) Please read the Posting Guide and post in plain text as it says to do. This is an adjustment you must make in your email client software, we cannot advise you how to do it here. b) Not clear why you want a matrix. A vector is more typical in R; most of the time using n*1 matrices is an unnec