[R] I need your help

From: KOITA Lassana - STAC/ACE <lassana.koita_at_aviation-civile.gouv.fr>
Date: Wed 22 Feb 2006 - 05:23:05 EST

Hi,
Dear R users
I have problem with the following code. The matrix result must be a matrix (3x3). But I have obtained a matrix(3x1) and I don't know why. So, I need your help

Best regards

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

taille <- function (delta, t, prob = 0.2)

{

niv.conf <- c(0.90, 0.95, 0.99)
if(niv.conf <- 0.90) {

   t <- 1.645
}

 else {

 if(niv.conf <- 0.95) {
   t <- 1.96
}

t <- 2.575
}

n <- length(delta)

m <- length(t)

result <- matrix(nrow = n, ncol = m);

for (i in 1:n)

   {
     for(j in 1:m)

      {

       result[i,j]<- prob*(1-prob)*((t[i])^2)/(delta[j])^2 ;

      }
   }

rownames(result) <- delta
colnames(result) <- niv.conf
round(result,2)

}

taille (delta <- c( 0.01, 0.02, 0.03), niv.conf <- c(0.90, 0.95, 0.99))

####################################################################"



Lassana KOITA
Etudes de Sécurité et d'Exploitation aéroportuaires / Aerodrome Safety & 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 Authority
Tel: 01 49 56 80 60
Fax: 01 49 56 82 14
E-mail: Lassana.Koita@aviation-civile.gouv.fr http://www.stac.aviation-civile.gouv.fr/



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 Received on Wed Feb 22 05:42:01 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:38 EST