Hi,
If you need the difference between two dates from the dataset,
Try this:
>dat1<-data.frame(DATETIME=c("1/1/2010 0:10","1/1/2010 0:20","1/1/2010
0:30"),HEADER1=c(197.19,203.88,206.56),HEADER2=c(100.08,100.10,100.04))
>dat1$DATETIME<-strptime(dat1$DATETIME, "%d/%m/%Y %H:%M")
>difftime(dat
First thing is to supply data in a usable form See ?dput for one easy way of
doing it.
In any case, assuming those dates and times are character values something like
this should work but not tested on your data.
Assuming the data frame is called dtime
dtime[,1] <- strptime(dtime[,1], "%d/%
You have been asked before (by me!) to give reproducible examples
using dput()...
You might need the diff() function.
Michael
On Thu, Jun 14, 2012 at 5:08 AM, Rantony wrote:
> Hi,
>
>
> Here, i have a matrix like this
>
> MyMatrix <-
>
> *DATETIME HEADER1 HEADER2*
> 1/1/2010 0
thank you! this really helps!
On Thu, Apr 22, 2010 at 7:00 PM, jim holtman wrote:
> ?strptime
>
> Read the documentation and you will find reference to "%OSn"
>
> > x <- strptime('13:45:34.123', format="%H:%M:%OS")
> > x
> [1] "2010-04-22 13:45:34"
> > format(x, format="%H:%M:%OS3")
> [1] "13:45
Carol Gao gmail.com> writes:
>
> Hi,
>
> Does anyone know how to take a time difference when the format of the time
> is as 13:22:23.586? I am trying to take the difference of time between stock
> transactions and need to keep the three decimal places for seconds. I have
> tried *diff(strptime(
?strptime
Read the documentation and you will find reference to "%OSn"
> x <- strptime('13:45:34.123', format="%H:%M:%OS")
> x
[1] "2010-04-22 13:45:34"
> format(x, format="%H:%M:%OS3")
[1] "13:45:34.123"
>
On Thu, Apr 22, 2010 at 2:58 AM, Carol Gao wrote:
> Hi,
>
> Does anyone know how to ta
On 22 July 2009 at 09:44, Erin Hodgess wrote:
| I am looking at the ctime attribute of two different files. It
| contains the year, month, day, time of creation and time zone.
[ Well only if you convert it to POSIXlt... ]
| Is there a way to determine the difference between the ctimes of two
|
Try this:
> file.info("abc.R")$ctime - file.info("aa.R")$ctime
Time difference of 228.9912 days
On Wed, Jul 22, 2009 at 10:44 AM, Erin Hodgess wrote:
> Dear R People:
>
> I am looking at the ctime attribute of two different files. It
> contains the year, month, day, time of creation and time zo
On Wednesday, July 22, 2009 10:44 AM, Erin Hodgess wrote:
> ...I am looking at the ctime attribute of
> two different files. It contains the year,
> month, day, time of creation and time zone.
> Is there a way to determine the difference
> between the ctimes of two files, please...
a
If what you have is a character string, then convert it to POSIXlt and
use difftime:
> x1
[1] "Wed Mar 18 12:18:11 2009"
> x2
[1] "Wed Mar 18 12:18:18 2009"
> x1.c <- strptime(x1, "%a %b %d %H:%M:%S %Y")
> x2.c <- strptime(x2, "%a %b %d %H:%M:%S %Y")
> difftime(x2.c, x1.c, units='secs')
Time diffe
I think the error message says it all. "fix" can not handle the data
type of tdiff:
> tdiff <-structure(c(168, NA, NA, 165, 175, 140, 191, 195, 130, 160, 135,
+ 165, 330, 178, 141, NA, 119, 90, 70, 99, 115, 70, 65, 90, 90, 65, 90, 75,
+ 85, 93, 52, 75, 60, 90, 105, 70, 65, 60, 85, 110, 65, 60,
11 matches
Mail list logo