Hi,
data are extracted from MS Access with the format: ("%d/%m%Y %H%M%S"); ex: 
16/09/2006 03:38:37
I still have error messneger

Thank you for your help. 

Lassana KOITA 
Chargé d'Etudes de Sécurité Aéroportuaire et d'Analyse Statistique  / 
Project Engineer Airport Safety Studies & Statistical analysis
Service Technique de l'Aviation Civile (STAC) / Civil Aviation Technical 
Department 
Direction Générale de l'Aviation Civile (DGAC) / French Civil Aviation 
Headquarters
Tel: 01 49 56 80 60
Fax: 01 49 56 82 14
E-mail: [EMAIL PROTECTED]
http://www.stac.aviation-civile.gouv.fr/



Uwe Ligges <[EMAIL PROTECTED]> 
12/08/2007 15:24

A
Matthew Walker <[EMAIL PROTECTED]>
cc
Henrique Dallazuanna <[EMAIL PROTECTED]>, r-help@stat.math.ethz.ch, KOITA 
Lassana - STAC/ACE <[EMAIL PROTECTED]>
Objet
Re: [R] need help to manipulate function and time interval








Matthew Walker wrote:
> Uwe Ligges wrote:
>> Henrique Dallazuanna wrote:
>> 
>>> Hi,
>>>
>>> Try whit:
>>>
>>> if(time[j] >= "18:00:00" & < "23:59:59")
>>> 
>>
>> This code is obviously wrong and does not help for the next few lines 
>> in the questioner's message, please do not post unsensible stuff.
>>
>> Uwe Ligges
>>
>> 
> 
> Actually, I would have said that was quite an interesting solution.  If 
> the time is guaranteed to be in this 8 character format, then that 
> idea's quite easily implemented:
> 
> # Returns true if time is between 18:00:00 and 23:59:59
> check_time <- function(time_string) {
>  if (nchar(time_string)!=8) stop ("Incorrect format")
>  time_string >= "18:00:00" & time_string <= "23:59:59"
> }
> 
> 
>  > check_time("19:59:00")
> [1] TRUE
>  > check_time("16:59:00")
> [1] FALSE
>  >
>  > check_time("18:00:00")
> [1] TRUE
>  > check_time("23:59:59")
> [1] TRUE
>  > check_time("24:00:00")
> [1] FALSE
>  >
>  > check_time("18:05")
> Error in check_time("18:05") : Incorrect format
> 
> 
> Perhaps there is an issue if the locale does not sort character-based 
> numbers in the same way as ASCII?  But Otherwise, I can't see why this 
> solution wouldn't do the job.
 >
> A more robust solution solution would parse the strings (?strptime) and 
> then check their days/hours/mins/seconds (?DateTimeClasses).  But 
> perhaps the above is sufficient?

Well, the interesting part of the original question that everynody seems 
to omit now was the second part:

if (time[j] is between 22:00:00 and 05:59:59)

hence the answer is still not sufficient (even if the syntax error has 
been corrected) - and hence I asked for the format the time is 
originally in.

Uwe Ligges




> Cheers,
> 
> Matthew


        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to