search for: medians

Displaying 20 results from an estimated 2264 matches for "medians".

Did you mean: media's
2011 Jun 28
3
Extract elements from objects in a list
...Max. 0.02271 0.25260 0.58130 0.52120 0.77270 0.99670 [[2]] Min. 1st Qu. Median Mean 3rd Qu. Max. 0.006796 0.259700 0.528100 0.515500 0.781900 0.993100 [[3]] Min. 1st Qu. Median Mean 3rd Qu. Max. 0.00927 0.22800 0.40780 0.46410 0.69460 0.98780 I want to extract (say) the medians as a vector. This would be: x[[1]][[3]] x[[2]][[3]] x[[3]][[3]] I thought there would be a way of doing this with something like apply(), but I cannot work it out. Is there a way of doing this without a loop? Thanks, Jeremy
2020 Sep 21
2
Help with the Error Message in R "Error in 1:nchid : result would be too long a vector"
Hello everyone, I am using *mlogit* to analyse my choice experiment data. I have *3 alternatives* for each individual and for each individual I have *9 questions*. I have a response from *516 individuals*. So it is a panel of 9*516 observations. I have arranged the data in long format (it contains 100 columns indicating different variables and identifiers). In mlogit I tried the following
2011 Jun 23
1
else problem
Dear R users, I have run into a problem using if...else and I hope you can shed some light on it. I am using R version 2.2.0.1. I have the following data frame: > head(dat2f) year tot_km3y [1,] 1964 0.1876854 [2,] 1965 0.1835116 [3,] 1966 0.1915012 [4,] 1967 0.1869758 [5,] 1968 0.2249865 [6,] 1969 0.1916011 I need to pick out the median year, and since there are an even number of data,
2016 Apr 14
4
Bug in by() function which works for some FUN argument and does not work for others
Dear Sirs, I am Professor at Indira Gandhi Krishi Vishwavidyalaya, Raipur, Chhattisgarh, India. While taking classes, I found the *by() *function producing following error when I use FUN=mean or median and some other functions, however, FUN=summary works. Given below is the output of the example I used on a built-in dataset "mtcars", along with error message reproduced herewith: >
2011 Jan 10
2
Step command failing for lm function
Hi, I have a fairly simple linear regression using the lm function. There are about 100 variables and 30,000 rows of data. It runs fine and produces a decent looking R2 value. I'm interested in performing a stepwise variable selection to see if things can be cleaned up a bit. Calling the step function returns ONE iteration (all the variables) and then stops. No errors are reported.
2012 Sep 26
2
specifying arguments in functions and calling functions, within functions
Esteemed R UseRs, Regarding specifying arguments in functions and calling functions within functions: ## beginning ## ## some data ex <- rnorm(10) ex[5] <- NA ## example function Scale <- function(x, method=c("mean", "median")) { scl <- method scl(x) } ## both return NA Scale(ex, method=median) median(ex, na.rm=FALSE) ## both return the median Scale(ex,
2005 May 20
1
bootstrapping vectors of unequal length
Dear R Help List, I have a vector of n and a vector of n-1 and I want to use boot() to bootstrap the ratio of their respective medians. I want to eventually use boot.ci() to generate confidence intervals. Because the vectors are not equal in length, I tried a few things, but have yet to be successful. Try 1: > x <- runif(20) > > y <- c(runif(19), NA) > > median(x) [1] 0.522284 > > median(y[1:19]) [...
2009 Jul 20
2
calculating median with a condition
Hello, I am trying to calculate the median of numbers across each row for the data shown below , with the condition that if the number is negative, that it should be ignored and the median should be taken of only the positive numbers. For eg: data is in Column A,B,C. Column D and E demonstrates what I want to get as answer A B C Median median value -13.6688115 -32.50914055
2017 Mar 01
1
stats::median
>>>>> Martin Maechler <maechler at stat.math.ethz.ch> >>>>> on Mon, 27 Feb 2017 10:42:19 +0100 writes: >>>>> Rob J Hyndman <Rob.Hyndman at monash.edu> >>>>> on Wed, 15 Feb 2017 21:48:56 +1100 writes: >> The generic stats::median method is defined as median <- >> function (x, na.rm = FALSE)
2017 Feb 15
2
stats::median
The generic stats::median method is defined as median <- function (x, na.rm = FALSE) {UseMethod("median")} I suggest that this should become median <- function (x, na.rm = FALSE, ...) {UseMethod("median")} This would allow additional S3 methods to be developed with additional arguments. Currently I have to over-ride this generic definition in the demography
2004 Jun 24
3
The "median" function in R does not work properly.
Hi, 1.) The "median" function does not work well. Please refer to the data below (same data is attached as txt-delimited). This is what I try to do in R: median ( dataf [2:9] ) I get warning: "needs numeric data" 2.) BUT if apply the median to a single vector: median ( dataf [,2]] ) then it works: 3.) How come the "median"
2006 Jan 20
3
function for rowMedian?
Hi is anybody aware of a function to calculate a the median for specified columns in a dataframe or matrix - so analogous to rowMeans? Thanks Max --
2016 Apr 14
0
Bug in by() function which works for some FUN argument and does not work for others
I think you are not using the best function for what your intentions are. Try: > by(data=mtcars, INDICES=list(as.factor(mtcars$am)), FUN=colMeans) : 0 mpg cyl disp hp drat wt qsec vs 17.1473684 6.9473684 290.3789474 160.2631579 3.2863158 3.7688947 18.1831579 0.3684211 am gear carb 0.0000000
2015 Jan 28
2
[Q] Get formal arguments of my implemented S4 method
...ge("str(norm.meth)") >str(norm.meth) >message("show(norm.meth at .Data)") >show(norm.meth at .Data) Last show() displays this: function (object, ...) { .local <- function (object, method = c("median", "vs", "tukey"), calc.medians = TRUE, sweep.cols = calc.medians, recalc.after.sweep = sweep.cols, ...) { .do_normalize(object, method = match.arg(method), calc.medians = calc.medians, sweep.cols = sweep.cols, recalc.after.sweep = recalc.after.sweep,...
2009 Aug 30
2
error with summary(vector)??
Hello, I get > summary(E) level nodes ave_nodes time Min. : 1 Min. : 1.00 Min. : 10.71 Min. : 0.0000 1st Qu.: 237414 1st Qu.: 2.00 1st Qu.: 19.70 1st Qu.: 0.0100 Median : 749229 Median : 3.00 Median : 27.01 Median : 0.0100 Mean : 767902 Mean : 49.85 Mean : 98.89 Mean : 0.2296 3rd
2009 Aug 21
4
help with median for each row
Hi, I tried looking through google search on whether there's a way to computer the median for each row of a nxn matrix and return the medians for each row for further computation. And also if the number of columns in the matrix are even, how could I specify which median to use? Thank you very much! -- Edward Chen [[alternative HTML version deleted]]
2016 Apr 15
4
Bug in by() function which works for some FUN argument and does not work for others
Dear All, Thanks for your help. However, I would like to draw your attention to the following: Actually, I was replicating the Example 2.3, using the dataset "brainsize.txt" given in Section 2.3.3 ("Summarize by group") at page 55, of a famous book "R by Example" written by "Jim Albert and Maria Rizzo" published in Springers (2012) in a Use R! Series. The
2015 Jan 28
2
[Q] Get formal arguments of my implemented S4 method
...n a different package), to provide default values, argname as key for UI label lookups, etc. So I want something much more like the formals of the implementation: { "object", "method": c("median", "vs", "tukey"), "calc.medians": TRUE, "sweep.cols": calc.medians, "recalc.after.sweep": sweep.cols, "?" } not those of the generic: { "object", "?" } From: Michael Lawrence <lawrence.michael at gene.com> Date: Wednesday, January...
2007 May 08
3
Median
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
2004 Mar 11
3
widen the screen place
I have this problem: my screen seems not wide enough in R. My true computer monitor is very wide, so I wish that I can line up the text when I stretch it wide. i.e.: This is typical R returns: > summary(a) V1 V2 V3 V4 F:625 Min. :20020103 EMC : 34 Min. : 9300300 L:944 1st Qu.:20020530 BRW : 27 1st Qu.: 9323865