[R] help with time data - R weird behaviour across machines

2012-03-06 Thread Tiago Marques
Hello list, I was hoping I could get some help on something which is really giving me a headache. I am using R version 2.14.1 (2011-12-22) (Platform: x86_64-pc-mingw32/x64 (64-bit)) An object which is supposed to have times has a few elements listed as not times but NA's ls() [1] todelete

Re: [R] help with time data - R weird behaviour across machines

2012-03-06 Thread Prof Brian Ripley
What timezones are you and your colleague in? 2011-03-27 01:00:01 does not exist in some timezones, e.g. Europe/London. As ?as.POSIXlt explains, you can expect such non-existent inputs to give NA. And from ?Sys.timezone: Note that except on Windows, the operation of time zones is an

Re: [R] Help with time in R

2010-07-21 Thread Aaditya Nanduri
Ms. Chisholm, If you could tell us how you plan to use the variables, we will have a better understanding of what you are looking for and will be able to help you. Are you looking for the time in seconds? In that case, do as Mr. Holfman says. He just skipped the part about converting the factors

Re: [R] Help with time in R

2010-07-21 Thread Saeed Abu Nimeh
You can use strptime to specify the format of the date and time you want, e.g. x1-strptime(x, %Y-%m-%d %H:%M:%S) x1 [1] 2010-04-02 12:00:05 str(x1) POSIXlt[1:1], format: 2010-04-02 12:00:05 On Wed, Jul 21, 2010 at 8:02 AM, Aaditya Nanduri aaditya.nand...@gmail.com wrote: Ms. Chisholm, If

[R] Help with time in R

2010-07-20 Thread Sarah Chisholm
Hi, I have a problem with the time formatting in R. I have entered time in the format MM:SS.xyz and R has automatically classified this as a factor, but I need it numerically. However when I use as.numeric() it gives me totally different numbers. Is there any way I can tell R to read thes

Re: [R] Help with time in R

2010-07-20 Thread jim holtman
# depends on what you want to do with it. # if you just want to convert to seconds, use the following x - c('12:23.45', '34:15.1', '1:34.23') # split by the : x.s - strsplit(x, :) # convert x.c - sapply(x.s, function(a){ + as.numeric(a[1]) * 60 + as.numeric(a[2]) + }) x.c [1] 743.45

Re: [R] Help with time in R

2010-07-20 Thread David Winsemius
On Jul 20, 2010, at 7:33 AM, Sarah Chisholm wrote: Hi, I have a problem with the time formatting in R. I have entered time in the format MM:SS.xyz and R has automatically classified this as a factor, but I need it numerically. However when I use as.numeric() it gives me totally

Re: [R] Help with time in R

2010-07-20 Thread David Winsemius
On Jul 20, 2010, at 8:41 AM, David Winsemius wrote: On Jul 20, 2010, at 7:33 AM, Sarah Chisholm wrote: Hi, I have a problem with the time formatting in R. I have entered time in the format MM:SS.xyz and R has automatically classified this as a factor, but I need it numerically. However