similar to: do.call and applying na.rm=TRUE

Displaying 20 results from an estimated 100000 matches similar to: "do.call and applying na.rm=TRUE"

2002 Apr 25
4
sum() with na.rm=TRUE, again
Hi: I remember a post several days ago by Jon Baron, concerning the behavior of sum() when one sets na.rm=TRUE: the result will be a zero sum for a vector of all NA's, as here, for the second row: > ss<- data.frame(x=c(1,NA,3,4),y=c(2,NA,4,NA)) > ss x y 1 1 2 2 NA NA 3 3 4 4 4 NA > apply(ss,1,sum,na.rm=TRUE) 1 2 3 4 3 0 7 4 I am rather alarmed by that zero, because
2017 Jul 27
0
na.rm = T treatment by ggplot2's geom_bar
To clarify: my question is not about "who could I exclude NAs from being counted" - I know how to do that. My question is: Why na.rm = T is not working for geom_bar in this case? On Thu, Jul 27, 2017 at 8:24 AM, Dimitri Liakhovitski < dimitri.liakhovitski at gmail.com> wrote: > Hello! > > I am trying to understand how ggplot2's geom_bar treats NAs. > The help file
2017 Jul 27
3
na.rm = T treatment by ggplot2's geom_bar
Hello! I am trying to understand how ggplot2's geom_bar treats NAs. The help file says: library(ggplot2) ?geom_bar na.rm: If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed. I am trying it out: md <- data.frame(a = c(letters[1:5], letters[1:4], letters[1:3], rep(NA, 3))) str(md); levels(md$a) ggplot(data = md, mapping = aes(x =
2017 Jul 27
1
na.rm = T treatment by ggplot2's geom_bar
I suspect this is by design. Questions about "why" should probably cc the contributed package maintainer(s). -- Sent from my phone. Please excuse my brevity. On July 27, 2017 7:49:47 AM PDT, Dimitri Liakhovitski <dimitri.liakhovitski at gmail.com> wrote: >To clarify: my question is not about "who could I exclude NAs from >being >counted" - I know how to do
2017 Jul 27
2
na.rm = T treatment by ggplot2's geom_bar
Just a thought: Did you try na.rm = TRUE in case you have an object named "T" in scope? -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Jul 27, 2017 at 7:49 AM, Dimitri Liakhovitski <dimitri.liakhovitski at
2017 Jul 27
0
na.rm = T treatment by ggplot2's geom_bar
Thank you, Bert! I do NOT have an object named "T" in scope (I checked - and besides, it would never occur to me to use this name). TRUE or T results in the same unexpected behavior: ggplot(data = md, mapping = aes(x = a)) + geom_bar(na.rm = TRUE) On Thu, Jul 27, 2017 at 10:57 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote: > Just a thought: > > Did you try
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
2017 Jul 27
2
na.rm = T treatment by ggplot2's geom_bar
I think you should be more suspicious of yourself, Dimitri. A letter T variable can easily arise in the problem domain when you are not thinking of logical values at all, at which point your cavalier use of T as a synonym for TRUE can suddenly become a bug. -- Sent from my phone. Please excuse my brevity. On July 27, 2017 8:18:03 AM PDT, Dimitri Liakhovitski <dimitri.liakhovitski at
2017 Jul 27
0
na.rm = T treatment by ggplot2's geom_bar
?hanks for the advice, Jeff. Will keep it in mind. But I am anal - I shy away from using letters and words that "look familiar" to me in R (such as mean, sd, T, etc.) But still, it's a good advice. On Thu, Jul 27, 2017 at 11:53 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote: > I think you should be more suspicious of yourself, Dimitri. A letter T > variable can
2010 Feb 06
3
melt on OSX ignores na.rm=T
Hi list, I run R on Linux and OSX. On both systems I use R version 2.9.2 (2009-08-24) and reshape version: 0.8.2 (2008-11-04). When I do a melt with na.rm=T on a data frame I get different results on these systems: library(reshape) x <- read.table(textConnection("char trial wn p E10I13D0 4 r E10I13D0 4 a E10I13D0 4 c E10I13D0 4 t E10I13D0 4 i E10I13D0 4 c E10I13D0 4 e E10I13D0
2011 Jul 12
3
Role of na.rm inside mean()
This is just posed out of curiosity, (not as a criticism per se). But what is the functional role of the argument na.rm inside the mean() function? If there are missing values, mean() will always return an NA as in the example below. But, is there ever a purpose in computing a mean only to receive NA as a result? In 10 years of using R, I have always used mean() in order to get a result, which is
2006 Jun 23
3
Problems with weekday extraction from zoo objects
Hi Folks! I'm struggling with dates - but enough about my personal life..... I have two daily time series files. In one (x) the date format is Y/m/d and the other (y) is d/m/y. I used read.zoo on both and they read into R with no problem. Then I use: weekdays(as.Date(x$DATE)) and get what I expect - all the days of the week in my data set. When I use:
2010 Oct 26
2
anomalies with the loess() function
Hello Masters, I run the loess() function to obtain local weighted regressions, given lowess() can't handle NAs, but I don't improve significantly my situation......, actually loess() performance leave me much puzzled.... I attach my easy experiment below #------SCRIPT---------------------------------------------- #I explore the functionalities of lowess() & loess() #because I have
2012 Oct 30
4
There is pmin and pmax each taking na.rm, how about psum?
Hi, Please consider the following : x = c(1,3,NA,5) y = c(2,NA,4,1) min(x,y,na.rm=TRUE) # ok [1] 1 max(x,y,na.rm=TRUE) # ok [1] 5 sum(x,y,na.rm=TRUE) # ok [1] 16 pmin(x,y,na.rm=TRUE) # ok [1] 1 3 4 1 pmax(x,y,na.rm=TRUE) # ok [1] 2 3 4 5 psum(x,y,na.rm=TRUE) [1] 3 3 4 6 # expected result Error: could not find function "psum" # actual result
2010 Jul 18
2
NA preserved in logical call - I don't understand this behavior because NA is not equal to 0
I am confused by the behavior of the below piece of code. The NAs are making it past the logical call ==0. I am sure that I am missing something. I just don't understand this behavior. Thanks for your help in advance. ########code####################################################### left <- (structure(list(measurment_num = c(2, 2.2, 2.4, 2.6, 2.8, 2.82, 3, NA, NA, NA),
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
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
2003 Jan 29
3
na.rm in sd()
Hello, I think this qualify as a bug > x<-c(1,2,3,4,NA,6,7) > mean(x) [1] NA > mean(x,na.rm=T) [1] 3.833333 > sd(x) Error in var(as.vector(x)) : missing observations in cov/cor > sd(x,na.rm=T) Error in sd(x, na.rm = T) : unused argument(s) (na.rm ...) > var(x) Error in var(x) : missing observations in cov/cor > var(x,na.rm=T) [1] 5.366667 > why sd() does not
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 Jul 31
3
na.rm problem
hi, i am a new member. i am using R in finding correlation between two variables of unequal length. when i use cor(x,y,na.rm=T,use="complete") where x has observations from 1928 to 2006 & y has observations from 1950 to 2006. I used na.rm=T to use the "complete observations". So missing values should be handled by casewise deletion. But it gives me error Error in