[R] problem with "which"

2008-04-23 Thread Melanie Abecassis
Hi, I'm having trouble with the "which" or the "seq" function, I'm not sure. Here's an example : > lat=seq(1,2,by=0.1) > lat [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 > which(lat==1) [1] 1 > which(lat==1.1) [1] 2 > which(lat==1.2) [1] 3 > which(lat==1.3) [1] 4 > which(lat==1.4) [1]

[R] Problem with which function

2012-10-12 Thread max
Hej, i need the which() funktion to find the positions of an entry in a matrix. the entries i'm looking for are : seq(begin,end,0.01) and there are no empty spaces i'm searching in the right range. so i was looking for the results R can find and i recieved this answer. for (l in 1:length(qr)){p

Re: [R] problem with "which"

2008-04-23 Thread David Winsemius
Melanie Abecassis <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Hi, > I'm having trouble with the "which" or the "seq" function, I'm not > sure. Here's an example : > > > > lat=seq(1,2,by=0.1) > > lat > [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 > > > which(lat==1) > [1] 1 > > w

Re: [R] problem with "which"

2008-04-23 Thread Berwin A Turlach
G'day Melanie, On Wed, 23 Apr 2008 17:46:56 -1000 Melanie Abecassis <[EMAIL PROTECTED]> wrote: > This doesn't seem to happen with integers. > Am I missing something ?? Yes, FAQ 7.31: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f > Is there a

[R] problem with 'which' and strings

2009-02-11 Thread Chrischizinski
I have written a function that goes through a database and calculates various metric scores and allocates them to a data set. For 400 of the 500 sites that I calculate these metrics for works fine and allocates the scores into the appropriate column. For some reason, some sites I run into the be

Re: [R] Problem with which function

2012-10-12 Thread Jeff Newmiller
See R FAQ 7.31. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research

Re: [R] problem with 'which' and strings

2009-02-11 Thread David Winsemius
Looks like you might be using vector addressing on a non-existent object. You have identified a column number, 14, to use. If you wanted to put the XXX.table$Metric.name vector into a column of orig.metric.scores (and it already existed with 10 rows), then you would would use matrix sty

Re: [R] problem with 'which' and strings

2009-02-11 Thread Chrischizinski
That would allocate, the vector down the column, correct? I should have specified this clearer. I want to put each metric value into the appropriate column (as designated by the metric name ) in a single row. My data set SCORES.combined has the column headings for all potential metrics that can

Re: [R] problem with 'which' and strings

2009-02-11 Thread jim holtman
You probably want to use either '%in%' or 'match'. The result of 14 that you are getting is due to recycling of the shorter vector and matching at the 14th position ("Insect-Tolerant"). On Wed, Feb 11, 2009 at 9:20 AM, Chrischizinski wrote: > > I have written a function that goes through a datab

Re: [R] problem with 'which' and strings

2009-02-11 Thread Chrischizinski
All it took was using 'match' instead of 'which'. Thanks for all your help! -- View this message in context: http://www.nabble.com/problem-with-%27which%27-and-strings-tp21955970p21958266.html Sent from the R help mailing list archive at Nabble.com. __