KOITA Lassana - STAC/ACE
2006-Feb-10 14:19 UTC
[R] Problem to paste the title of the columns and the rows
Hi, This following function works correctly. However, I would like to improve it by adding to the table of result the titles of columns and rows. I prefer to define vector column by : D = (Dj = debit[j] , j=1:length(debit)) and vector row by: J = (Ji = time [ i ], i = 1: length(time)) Thank for your help ################################# forage <- function (time, debit, n,ind) { pop <- 16867*(1.025^n) bes <- pop*ind requis <- 1.2*ind*pop #906.83 n <- length(time) m <- length(debit) result <- matrix(ncol = m, nrow = n); for (i in 1:n) { for(j in 1:m) { result[i,j] <- (time[i]*debit[j]) - requis; } } #result; round(result,2) #round(rbind(pop = pop,bes = bes,requis = requis), 2) } forage (time <- seq( 10,24, by = 2), debit <- c( seq(8.17, 51.43, by = 8.57), 55, 60),20, 0.035) 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 at aviation-civile.gouv.fr http://www.stac.aviation-civile.gouv.fr/