Re: [R] which() function help page precision

2018-11-17 Thread Juan Gomez
Hi again (, I am the PO from my own email account) I agree that the word "basically" puts the NA issues aside. But my point is that R subsetting behavior when there are NAs in a logical index is quite tricky to say the less, and deserves the trouble of pointing it out in every place it is appro

Re: [R] which() function help page precision

2018-11-16 Thread Martin Maechler
> peter dalgaard > on Fri, 16 Nov 2018 13:39:27 +0100 writes: > Well, "Basically, " is an excuse for not being > accurate. Making the code more complex doesn't really help > the explanation. It could be better to just add "(except > for NA handling)" or so. > -pd

Re: [R] which() function help page precision

2018-11-16 Thread peter dalgaard
Well, "Basically, " is an excuse for not being accurate. Making the code more complex doesn't really help the explanation. It could be better to just add "(except for NA handling)" or so. -pd > On 16 Nov 2018, at 11:08 , buzon informatica, ige > wrote: > > The which() function help page s

Re: [R] which function

2016-06-04 Thread Jim Lemon
Hi Gafar, As Jeff has pointed out, the median value may not exist within the dataset. However, this function will give you either the position of the value that is the median, or the position of the two closest values if none equal the median. Be aware that this function may fall victim to the "ind

Re: [R] which function

2016-06-04 Thread Jeff Newmiller
The median is not always a member of the data set. What do you really want? I for one would want people to follow the guidance in the footer on every email on this mailing list. -- Sent from my phone. Please excuse my brevity. On June 4, 2016 9:01:41 AM PDT, Gafar Matanmi Oyeyemi wrote: >De

Re: [R] which() function not finding certain numbers

2012-08-15 Thread Tom Bird
Yes, the round(seq( )) sollution does it. Many thanks to the sender of this (and other similar) solutions. TB On Thu, Aug 16, 2012 at 3:45 AM, Petr Savicky wrote: > On Wed, Aug 15, 2012 at 10:37:17PM +1000, Tom Bird wrote: > > Hi, > > > > I am using 32-bit R v 2.15.1, on Mac OsX v 10.6.8 with

Re: [R] which() function not finding certain numbers

2012-08-15 Thread arun
HI, Try this:  S<-as.numeric(formatC(seq(0,4,0.01),digits=3))  which(S==2.02) #[1] 203  which(S==2.03) #[1] 204  which(S==3.03) #[1] 304  which(S==3.3) #[1] 331  which(S==3.) #[1] 301 A.K. - Original Message - From: Tom Bird To: r-help@r-project.org Cc: Sent: Wednesday, August 15, 201

Re: [R] which() function not finding certain numbers

2012-08-15 Thread Petr Savicky
On Wed, Aug 15, 2012 at 10:37:17PM +1000, Tom Bird wrote: > Hi, > > I am using 32-bit R v 2.15.1, on Mac OsX v 10.6.8 with R GUI 1.52 Leopard > build 32-bit (6188). I have also replicated this error on R 2.13.2 on a > windows 7 machine. > > In some sequences of numbers, I am unable to use the w

Re: [R] which() function not finding certain numbers

2012-08-15 Thread Jeff Newmiller
FAQ 7.31 ?is.equal --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Resea

Re: [R] which() function not finding certain numbers

2012-08-15 Thread John Kane
It looks like an example of FAQ 7.31 Why doesn't R think these numbers are equal? John Kane Kingston ON Canada > -Original Message- > From: tomasb...@gmail.com > Sent: Wed, 15 Aug 2012 22:37:17 +1000 > To: r-help@r-project.org > Subject: [R] which() function not finding certain number

Re: [R] Which function to use: grep, replace, substr etc.?

2011-10-16 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of David Winsemius > Sent: Sunday, October 16, 2011 1:59 PM > To: Jeff Newmiller > Cc: r-help@r-project.org; syrvn > Subject: Re: [R] Which function to use:

Re: [R] Which function to use: grep, replace, substr etc.?

2011-10-16 Thread David Winsemius
On Oct 16, 2011, at 1:32 PM, Jeff Newmiller wrote: Note that "male" comes before "female" in your data frame. --- Jeff Newmiller The . . Go Live... syrvn wrote: Hi, thanks for the tip! I do it as follows now

Re: [R] Which function to use: grep, replace, substr etc.?

2011-10-16 Thread Jeff Newmiller
Note that "male" comes before "female" in your data frame. --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /S

Re: [R] Which function to use: grep, replace, substr etc.?

2011-10-16 Thread syrvn
Hi, thanks for the tip! I do it as follows now but I still have a problem I do not understand: abbrvs <- data.frame(c("peter", "name", "male", "female"), c("P", "N", "m", "f")) colnames(abbrvs) <- c("pattern", "replac

Re: [R] Which function to use: grep, replace, substr etc.?

2011-10-16 Thread David Winsemius
On Oct 16, 2011, at 12:35 PM, syrvn wrote: Hello, I have a simple question but I don't know which method is best to use for my problem. I have the following strings: str1 <- "My_name_is_peter" str2 <- "what_is_your_surname_peter" I would like to apply predefined abbreviations for peter=p

Re: [R] which function

2010-06-02 Thread Ivan Calandra
Hi, Try with more parentheses: > l[((which(100420==l))-1):which(100420==l)] [1] "100419" "100420" It was interpreted as 4-(1:4)=3 2 1 0 Ivan Le 6/2/2010 09:41, arnaud Gaboury a écrit : Dear group, Here is a list of elements : l<- c("100415", "100416", "100419", "100420", "100421", "100422"

Re: [R] which function

2010-06-02 Thread mohamed . lajnef
Hi Arnaud Try this l[((which(100420==l))-1):which(100420==l)] Regards Mo arnaud Gaboury a écrit : Dear group, Here is a list of elements : l <- c("100415", "100416", "100419", "100420", "100421", "100422", "100423", "100426", "100427", "100428", "100429", "100430", "100503", "100504", "1

Re: [R] which function

2010-06-02 Thread arnaud Gaboury
The correct line is : > l[(which(100420==l)-1):which(100420==l)] [1] "100419" "100420" > -Original Message- > From: arnaud Gaboury [mailto:arnaud.gabo...@gmail.com] > Sent: Wednesday, June 02, 2010 9:41 AM > To: r-help@r-project.org > Cc: 'arnaud Gaboury' > Subject: which function > >