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
,], 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
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")
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
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","
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
6 matches
Mail list logo