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

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

[R] which() function help page precision

2018-11-16 Thread buzon informatica, ige
The which() function help page states that, in the default case, what the function returns is: " Basically, the result is (1:length(x))[x]." That would only be true if there are not any NA values in x. I think it would be more accurate to say: "Basically, the result is (1:length(x))[!is.na(x) &

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

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

[R] which function

2016-06-04 Thread Gafar Matanmi Oyeyemi
Dear, I need help on which.min and which.max. functions. Is there a function to fetch me the point that in vector that gives median value such like the commands for minimum and maximum values. Thanks. [[alternative HTML version deleted]] __

[R] which() function not finding certain numbers

2012-08-15 Thread Tom Bird
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 which() function to index certain values.It seems to be primarily

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 numbers

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

2012-08-15 Thread Jeff Newmiller
FAQ 7.31 ?is.equal --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#..

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 which()

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 savi...@cs.cas.cz 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

[R] which function/method to find agreement between two

2012-01-24 Thread Mary Kindall
Hi I have data in the following format: itemsperson1 person2 - - -- car honda,toyotahonda bikesuzuki suzuki pant Lee Levis, Lee shirt Van_housen Hollister house rented

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

2011-10-16 Thread syrvn
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 and name=n to both strings so that the new strings

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 and

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, replacement) str

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:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer

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 ment...@gmx.net wrote: Hi, thanks for the tip! I do it as

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: grep, replace, substr etc

[R] Which function for this?

2011-10-05 Thread lunarossa
I have a matrix like this 0.05 0.13 1.2 0 0 0 0 0 red 0 0 0 0 0 0 0 0 white 0 0.06 0 0 0 0 0 0 blue If only 1 number in the first 8 columns is more than 0, in a new variable I write 1, if they're all 0 or less, I write 0, so 0.05 0.13 1.2 0 0 0 0 0 red 1 0 0 0

[R] Which function in R package Spatstat can help me to get the Cramer-von Mises statistic

2011-02-22 Thread Jeff Fang
Hi all, When I detect the spatial point pattern, I want to use the Cramer-von Mises statistic to assess the curve-wise significance of deviations from null hypotheses. Who can tell me which function in R package Spatstat can do this work? Thanks a lot Jeff [[alternative HTML version

[R] which function

2010-06-02 Thread arnaud Gaboury
Dear group, Here is a list of elements : l - c(100415, 100416, 100419, 100420, 100421, 100422, 100423, 100426, 100427, 100428, 100429, 100430, 100503, 100504, 100505, 100506, 100507, 100510, 100511, 100512, 100513, 100514, 100517, 100518, 100519, 100520, 100521, 100524, 100525, 100526,

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 Dear group,

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 arnaud.gabo...@gmail.com 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,

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, 100423, 100426,