Sorry Henrique
 
But I'm affraid now the result was
 
 
    x  y
1  1  2
2  1  2
3  1  2
4  1  2
5  1  2
6  1  2
 
 
I think we are very close to the solution. But it isn't this one!!!
 
Where should I look for?
 
 
Sorry for the inconvenience,
 
Diogo André Alagador
Portugal
 
 
 

from: Henrique Dallazuanna [mailto:[EMAIL PROTECTED] 
Sent: segunda-feira, 22 de Outubro de 2007 21:03
for: Diogo Alagador
Cc: r-help@r-project.org
 Re: [R] median value dataframe coming from multiple dataframes

 

Hi Diogo, 

teste <- function(x){
    if(!is.list(x))stop("A list is needed")
        df_out <- matrix(0, ncol=ncol(x[[1]]), nrow=nrow(x[[1]]))
            for(i in 1:ncol(x[[1]])){
            df_out[,i] <- apply( do.call("rbind", lapply(x, "[[", i)), 2, 
median)    
        }
    return(df_out)
}

x <- list(df1, df2, df3, df4)

teste(x)

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil 
25° 25' 40" S 49° 16' 22" O 

 
 

        [[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.

Reply via email to