search for: median

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

Did you mean: media
2011 Jun 28
3
Extract elements from objects in a list
Hi All, I want to extract elements of elements in a list. Here's an example of what I mean: If I create a list: x <- as.list(100) for(loop in c(1:100)) { x[[loop]] <- summary(runif(100)) } > head(x) [[1]] Min. 1st Qu. Median Mean 3rd Qu. 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 t...
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
...ng 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, I cannot use 'median' directly since it gives me a non-existent year/discharge. I found a way to get around that with the following: md <- dat2f[, list(med_year = max(year[which(abs(tot_km3y - median(tot_km3y)) == min(abs(tot_km3y - me...
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: > by(data=mtcars, INDICES=list(mtcars$am), FUN=mean) : 0 [1] NA ----------------------------------------...
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, method="median") median(ex, na.rm=TRUE) ## 1. Why does the use of apostrophes have this effect when calling ## a fucntion within a function?...
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...
2017 Mar 01
1
stats::median
...t;> 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) {UseMethod("median")} >> I suggest that this should become median <- function (x, >> na.rm = FALSE, ...) {UseMethod("median")} >> This would allow additional S3 methods...
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....
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]]...
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
...4 PM, Akhilesh Singh < akhileshsingh.igkv at gmail.com> wrote: > 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: > > > by(data=mtcars, INDICES=list(mtcars$am), FUN=mean) > : 0 > [1] NA &g...
2015 Jan 28
2
[Q] Get formal arguments of my implemented S4 method
...Method("normalize", "MatrixLike") >message("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,...
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 Qu.:1111288 3rd Qu.: 7.00 3rd Qu.: 80.38 3rd Qu.: 0.0300 Max. :2097152 Max. :70632.00 Max. :4451.67 Max. :338.9200 ave_time...
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
...ail.com> wrote: > >> 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: >> >> > by(data=mtcars, INDICES=list(mtcars$am), FUN=mean)...
2015 Jan 28
2
[Q] Get formal arguments of my implemented S4 method
...flect the information for use with corresponding fields in GUI (in 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 Lawre...
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...
2004 Mar 11
3
widen the screen place
...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 N:615 Median :20020807 Q : 23 Median : 9355230 Mean :20020761 DSS : 22 Mean : 9404488 3rd Qu.:20021015 LU : 20 3rd Qu.: 9410738 Max. :20021231 SLR : 20 Max. :13191609 (Other):2038...