Hello.
I need calculate the median of several column of a data.frame, in a new
column of this data frame, but the median operator only calculate from a
vector.
I have made a functionc that calculate the median but it is very slow.
Are there any method in any package to calculate this?
Best regards.
Jose Sierra.
A B C
-0.01678042 -0.0003354948 -0.0003354948
0.17320485 0.2359448911 0.4884204711
-0.76066019 -0.6024409891 -0.5814788340
-0.04365426 -0.0060560612 -0.0025470274
0.01885735 0.0027792718 0.0184081858
-0.07275884 -0.0371542622 -0.0315041630
0.05740122 0.0814235514 0.0468193512
-0.05404834 -0.0590145580 0.0489612929
-0.28197518 -0.1899247807 -0.2089076920
-0.02465713 -0.2222512947 -0.2688619668
Median
4 messages · Jose Sierra, José Fernández Menéndez, R. Villegas +1 more
i don't understand very well but apply(your_data_frame, 1,median) calculates the median of every row of your data frame apply(your_data_frame, 2, median) calculates the median of every column 2007/5/8, Jose Sierra <jose.sierra at integromics.com>:
Hello.
I need calculate the median of several column of a data.frame, in a new
column of this data frame, but the median operator only calculate from a
vector.
I have made a functionc that calculate the median but it is very slow.
Are there any method in any package to calculate this?
Best regards.
Jose Sierra.
A B C
-0.01678042 -0.0003354948 -0.0003354948
0.17320485 0.2359448911 0.4884204711
-0.76066019 -0.6024409891 -0.5814788340
-0.04365426 -0.0060560612 -0.0025470274
0.01885735 0.0027792718 0.0184081858
-0.07275884 -0.0371542622 -0.0315041630
0.05740122 0.0814235514 0.0468193512
-0.05404834 -0.0590145580 0.0489612929
-0.28197518 -0.1899247807 -0.2089076920
-0.02465713 -0.2222512947 -0.2688619668
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
2007/5/8, Jose Sierra <jose.sierra at integromics.com>:
Hello.
I need calculate the median of several column of a data.frame, in a new
column of this data frame, but the median operator only calculate from a
vector.
I have made a functionc that calculate the median but it is very slow.
Are there any method in any package to calculate this?
Best regards.
Jose Sierra.
A B C
-0.01678042 -0.0003354948 -0.0003354948
0.17320485 0.2359448911 0.4884204711
-0.76066019 -0.6024409891 -0.5814788340
-0.04365426 -0.0060560612 -0.0025470274
0.01885735 0.0027792718 0.0184081858
-0.07275884 -0.0371542622 -0.0315041630
0.05740122 0.0814235514 0.0468193512
-0.05404834 -0.0590145580 0.0489612929
-0.28197518 -0.1899247807 -0.2089076920
-0.02465713 -0.2222512947 -0.2688619668
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Maybe you can start with this: m2 <- data.frame(matrix(c( -0.01678042, -0.0003354948, -0.0003354948, 0.17320485, 0.2359448911, 0.4884204711, -0.76066019, -0.6024409891, -0.5814788340, -0.04365426, -0.0060560612, -0.0025470274, 0.01885735, 0.0027792718, 0.0184081858, -0.07275884, -0.0371542622, -0.0315041630, 0.05740122, 0.0814235514, 0.0468193512, -0.05404834, -0.0590145580, 0.0489612929, -0.28197518, -0.1899247807, -0.2089076920, -0.02465713, -0.2222512947, -0.2688619668 ),nrow=10)) m2[,4]<- median(m2[,1]) m2[,5]<- median(m2[,2]) m2[,6]<- median(m2[,3]) Rod.
Please, Jose, do NOT misuse R-devel for such questions! There's R-help (and many good books on R and maybe your local R expert) for asking such questions. Definitely *not* the R-devel mailing list. --> http://www.R-project.org/mail.html , the posting guide, etc. Martin Maechler, ETH Zurich {as maintainer of these R mailing lists}
Hello. I need calculate the median of several column of a data.frame, in a new column of this data frame, but the median operator only calculate from a vector. I have made a functionc that calculate the median but it is very slow. Are there any method in any package to calculate this? Best regards. Jose Sierra. A B C -0.01678042 -0.0003354948 -0.0003354948
............