Hi R-users,

I have to define a noise level function L and its energy in the various 
moment of the day by:

 if time is between 18:00:00 and 23:59:59 then  L[j] <- L[j]+5 and W <- 
10^((L+5)/10) 

if time is between 22:00:00 and 05:59:59 ==> L <- L+10  and W <- 
10^((L+10)/10)
else
L=L and W = W

Could someone help me to realize this function please? You will find my 
following proposal  code, but my main problem is to handle the time 
interval.

Best regard

###########################
myfunc <- function(mytab, Time, Level)
{
vect <- rep(0, length(mytab))
for(i in 1:length(vect))
   {
      for(j in 1:length(Time))

            if(time[j] is between 18:00:00 and 23:59:59) 

            L[i] <- L[j]+5 
 
           vect[i] <- 10^((L[i])/10

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

            L[i] <- L[j]+10 
 
             vect[i] <- 10^((L[i])/10

            else 
 
           L[i] = L[j]
 
          vect[i] <- 10^((L[i])/10
     } 
} 

#######################

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/
        [[alternative HTML version deleted]]

______________________________________________
[email protected] 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