similar to: sum() with na.rm=TRUE, again

Displaying 20 results from an estimated 20000 matches similar to: "sum() with na.rm=TRUE, again"

2007 Aug 29
0
sum(data.frame(),na.rm=TRUE) still throws an Error
Hello, sum(data.frame(),na.rm=TRUE) still throws an Error, is this really the intended behavior? > sum(data.frame()) Error in FUN(X[[1L]], ...) : only defined on a data frame with all numeric or complex variables > sum(data.frame(),na.rm=TRUE) Error in FUN(X[[1L]], ...) : only defined on a data frame with all numeric or complex variables The context is # x is a data frame generated from
2003 Apr 28
2
sum(..., na.rm=TRUE) oddity
Hi all, I get two different results when using sum() and the switch na.rm. The result is correct when na.rm=FALSE. Linux Redhat 7.3, R version 1.6.1. I've had no luck searching the mail archives, so I was hoping somebody could explain/check this one for me. I will need to apply the function to missing data, simple as it is. Code: x<-matrix(runif(20,0,5)%/%1,4,5) # random matrix
2002 Aug 14
2
Smoothing estimated probabilities
Hello: I have been using sm.binomial() in the Bowman and Azzalini's sm package to smooth and plot estimated probabilities as a function of a covariate. I am concerned about my choice of bandwidth, and I was hoping there was another method available in some other package, perhaps with an automatic choice of smoothing parameter. Does anyone know of one? Thanks in advance. Tom Richards
2002 Aug 26
3
Random unit vectors in R^{n}
Hello: Can you tell me if there's a simple way to generate in R random vectors on the unit sphere in R^{n}? Additionally, are there references for this question? Thanks in advance. Tom -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or
2008 Dec 07
5
How to force aggregate to exclude NA ?
The aggregate function does "almost" all that I need to summarize a datasets, except that I can't specify exclusion of NAs without a little bit of hassle. > set.seed(143) > m <- data.frame(A=sample(LETTERS[1:5], 20, T), B=sample(LETTERS[1:10], 20, T), C=sample(c(NA, 1:4), 20, T), D=sample(c(NA,1:4), 20, T)) > m A B C D 1 E I 1 NA 2 A C NA NA 3 D I NA 3 4 C I
2010 Jul 07
3
quantiles on rows of a matrix
I'm trying to obtain the mean of the middle 95% of the values from each row of a matrix (that is, the highest and lowest 2.5% of values in each row are removed before calculating the mean). I am having all sorts of problems with this; for example the command: apply(matrix1,1,function(x) quantile(c(.05,.90),na.rm=T)) returns the exact same quantile values for each row, which is clearly
2015 Jun 01
0
sum(..., na.rm=FALSE): Summing over NA_real_ values much more expensive than non-NAs for na.rm=FALSE? Hmm...
This is a great example how you cannot figure it out after spending two hours troubleshooting, but a few minutes after you post to R-devel, it's just jumps to you (is there a word for this other than "impatient"?); Let me answer my own question. The discrepancy between my sum2() code and the internal code for base::sum() is that the latter uses LDOUBLE = long double (on some system
2011 Nov 20
2
Adding two or more columns of a data frame for each row when NAs are present.
I am fairly new to R and would like help with the problem below. I am trying to sum and count several rows in the data frame yy below. All works well as in example 1. When I try to add the columns, with an NA in Q21, I get as NA as mySum. I would like NA to be treated as O, or igored. I wrote a function to try to count an NA element as 0, Example 3 function. It works with a few warnings,
2008 May 02
0
Using option na.rm=True in function SD does not work for matrix with complete columns of NAs (PR#11364)
Dear R-developers, =20 according to the "what's new"-section in version R 2.7.0, there has been = a change in the working of co[rv] and so also in sd and var. =20 I am afraid, that the use of function sd with option "na.rm=3DT" has not = been changed appropriately. So the following problem exists with missing = data: =20 > sessionInfo() R version 2.7.0 (2008-04-22)=20
2009 Oct 29
1
weighted.mean uses zero when na.rm=TRUE (PR#14032)
The weighted.mean() function replaces NA values with 0.0 when the user specifies na.rm=TRUE: x <- c(101, 102, NA) mean(x, na.rm=TRUE) # 101.5, correct weighted.mean(x, na.rm=TRUE) # 67.66667, wrong weighted.mean(x, w=c(1,1,1), na.rm=TRUE) # 67.66667, wrong weighted.mean(x, w=c(1,1,1)/3, na.rm=TRUE) # 67.66667, wrong The weights are
2006 Aug 01
1
Global setting for na.rm=TRUE
Hello! Is it possible to set na.rm=TRUE in a global way? I'am constantly forgeting on this when performing analyses. I agree that one should be carefull with this when developing some code, but not necesarilly so in data analysis. Lep pozdrav / With regards, Gregor Gorjanc ---------------------------------------------------------------------- University of Ljubljana PhD student
2010 Jul 23
1
na.rm=TRUE
POS=sum(x[-1][x[-1]>0],na.rm=TRUE) is this the correct syntax? -- View this message in context: http://r.789695.n4.nabble.com/na-rm-TRUE-tp2299596p2299596.html Sent from the R help mailing list archive at Nabble.com.
2011 May 12
1
do.call and applying na.rm=TRUE
Hi all! I need to do something really simple using do.call. If I want to call the mean function inside do.call, how do I apply the condition na.rm=TRUE? So, I use do.call(mean, list(x)) where x is my data. This works fine if there are no NAs. Thanks, John [[alternative HTML version deleted]]
2002 Sep 30
3
R installation on Linux
Dear, I'm new to both Linux and R. I've to build R from source code and typed in the R-1.5.1 directory ./configure the configuration starts but after a few lines the following error occurs: checking for C compiler default output... configure: error: C compiler cannot create executables what should i do? Kind Regards, Steffen Durinck
2007 Jun 20
2
Expected behavior from: all(c(NA, NA, NA) < NA, na.rm = TRUE)?
Hi all, Came across this curious behavior in: R version 2.5.0 Patched (2007-06-05 r41831) A simplified example is: > all(c(NA, NA, NA) > NA, na.rm = TRUE) [1] TRUE Is this expected by definition? If one reduces this to individual comparisons, such as : > NA > NA [1] NA > all(NA > NA) [1] NA > all(NA > NA, na.rm = TRUE) [1] TRUE the initial comparison on the 3
2008 Jan 14
1
a way to interrupt a stuck R session on OSX
Discovered by accident: If your R session has become unresponsive to escape presses etcetera, you can try this. Open a terminal window, run the command ps -ax | grep R.app Note the process ID number in the first column. Say it's 1234. Then run kill -4 1234 The key is that the signal you are sending to R.app is "4". The Console will now ask you how you want to exit. This
2011 Aug 12
2
rollapply.zoo() with na.rm=TRUE
Hi. I'm comparing output from rollapply.zoo, as produced by two versions of R and package zoo. I'm illustrating with an example from a R-help posting 'Zoo - bug ???' dated 2010-07-13. My question is not about the first version, or the questions raised in that posting, because the behaviour is as documented. I'm puzzled as to why na.rm no longer is passed to mean, i.e. why
2007 Jun 28
3
Function call within a function.
I am trying to call a funtion within another function and I clearly am misunderstanding what I should do. Below is a simple example. I know lstfun works on its own but I cannot seem to figure out how to get it to work within ukn. Basically I need to create the variable "nts". I have probably missed something simple in the Intro or FAQ. Any help would be much appreciated. EXAMPLE
2008 Jan 14
1
savehistory in OSX version
Running Version 2.6.0 GUI 1.21. Generally, I enjoy working with the OSX GUI, which has some very pleasant features. Kudos to the developers! There is a nice history panel which slides out of the Console window. The buttons on the panel work as expected. I am puzzled by the behavior of history() and savehistory() run from the Console window. I would think that these functions would view and
2008 Jul 08
1
aggregate() function and na.rm = TRUE
All, I've been using aggregate() to compute means and standard deviations at time/treatment combinations for a longitudinal dataset, using na.rm = TRUE for missing data. This was working fine before, but now when I re-run some old code it isn't. I've backtracked my steps and can't seem to find out why it was working before but not now. In any event, below is a reproducible