Re: [R] Problem with strptime

2012-05-28 Thread Des Callaghan
Fantastic, thanks very much Richard. The addition of 'tz=GMT' worked a
treat. Best wishes, Des

 

From: Richard M. Heiberger [mailto:r...@temple.edu] 
Sent: 28 May 2012 02:09
To: Des Callaghan
Cc: r-help@r-project.org
Subject: Re: [R] Problem with strptime

 

Some of your dates are displayed BST and some GMT.

High probablilty your dates span the break between summer time and regular
time when

certain hours do not exist.  (in the US we go from 0200 directly to 0301 in
the spring when we move

from standard time to daylight time).  0230 would therefore be displayed as
NA.

 

You will need to take control of the time zone, probably by forcing GMT at
all times.

On Sun, May 27, 2012 at 3:56 PM, Des Callaghan
des.callag...@ecostudy.co.uk wrote:

Hello Forum,



I have a problem with the strptime function. With the 'data1' dataset below
it works fine, but with the 'data2' dataset something goes wrong (see final
line below). Both data1 and data2 are in exactly the same original format,
the only difference is that they span different dates. Please help, since it
is driving me nuts! Many thanks.



Best wishes,

Des

-

 data1=read.table(data1.txt,header=T,sep=\t)

 datetime1=strptime(data1$Date, %a %b %d %H:%M:%S %Y) #example line from
data1 'Tue Aug 16 03:00:01 2011'

 summary(datetime1)

Min.   1st Qu.
Median  Mean

2011-08-15 21:00:01 BST 2011-10-08 01:00:01 BST 2011-11-30 05:00:01
GMT 2011-11-30 04:38:47 GMT

 3rd Qu.  Max.

2012-01-22 09:00:01 GMT 2012-03-15 13:00:01 GMT

 min(datetime1)

[1] 2011-08-15 21:00:01 BST

 data2=read.table(data2.txt,header=T,sep=\t)

 datetime2=strptime(data2$Date, %a %b %d %H:%M:%S %Y) #example line from
data2 'Sun Nov 27 13:07:01 2011'

 summary(datetime2)

Min.   1st Qu.
Median  Mean

2011-11-27 01:07:01 GMT 2012-01-09 20:07:01 GMT 2012-02-22 15:07:01
GMT 2012-02-22 15:26:16 GMT

 3rd Qu.  Max.

2012-04-06 12:07:01 BST 2012-05-20 07:07:01 BST

 min(datetime2)

[1] NA










   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

 

  _  

No virus found in this message.
Checked by AVG - www.avg.com



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem with strptime

2012-05-27 Thread Des Callaghan
Hello Forum,

 

I have a problem with the strptime function. With the 'data1' dataset below
it works fine, but with the 'data2' dataset something goes wrong (see final
line below). Both data1 and data2 are in exactly the same original format,
the only difference is that they span different dates. Please help, since it
is driving me nuts! Many thanks.

 

Best wishes,

Des

-

 data1=read.table(data1.txt,header=T,sep=\t)

 datetime1=strptime(data1$Date, %a %b %d %H:%M:%S %Y) #example line from
data1 'Tue Aug 16 03:00:01 2011'

 summary(datetime1)

 Min.   1st Qu.
Median  Mean 

2011-08-15 21:00:01 BST 2011-10-08 01:00:01 BST 2011-11-30 05:00:01
GMT 2011-11-30 04:38:47 GMT 

  3rd Qu.  Max. 

2012-01-22 09:00:01 GMT 2012-03-15 13:00:01 GMT 

 min(datetime1)

[1] 2011-08-15 21:00:01 BST

 data2=read.table(data2.txt,header=T,sep=\t)

 datetime2=strptime(data2$Date, %a %b %d %H:%M:%S %Y) #example line from
data2 'Sun Nov 27 13:07:01 2011'

 summary(datetime2)

 Min.   1st Qu.
Median  Mean 

2011-11-27 01:07:01 GMT 2012-01-09 20:07:01 GMT 2012-02-22 15:07:01
GMT 2012-02-22 15:26:16 GMT 

  3rd Qu.  Max. 

2012-04-06 12:07:01 BST 2012-05-20 07:07:01 BST 

 min(datetime2)

[1] NA

 

 

 

 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] model selection method - step() or bic.glm()

2008-01-20 Thread Des Callaghan
Dear R-helpers,
 
I'm considering two methods of selecting a poisson regression model within
R:
1. Using the step() function (stats package) to find the best model by a
stepwise algorithm and AIC
2. Using the bic.glm() function (BMA package) to find the best model by
Bayesian Model Averaging and BIC
 
Are these both reasonable methods for model selection or is one clearly more
appropriate than the other?
 
I understand this is more of a stats question than an R software question,
but I hope someone can help. Thanks in advance.
 
Best wishes,
Des

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.