[R] Conditionally Removing data from a vector
J_R_36 at hotmail.com
Fri Nov 21 20:45:29 CET 2008
I greatly apoligize, clear in my own mind, just didnt explain well enough.
DEVS should equal 6 values the last being 620, like the data frame:
> [1,] 100 120
> [2,] 101 220
> [3,] 102 320
> [4,] 103 420
> [5,] 104 520
> [6,] 105 620
And yes, my first question is do i need a "if" statement at all as the which
command seems to do the same thing. IN my working code i start with a
vector of Candidates, a process occurs that looks up a value associated with
each of those Candidates. If the corresponding value is equal to or larger
than the starting value, in the test case the DEV value, then that Candidate
is kept and the next Candidate is analyzed. The final product is a new
vector of Candidates, those that are equal to or larger than the DEV value.
Hope i didnt further the perfection of your confucion. Thanks for your
time, let me know if i need to ask a better question
Philipp Pagel-5 wrote:
>> I am having trouble removing entries from a vector based on the value of
>> vector and another object value. It works in my pseudo test run:
>> CANDS DEVS
>> [1,] 100 120
>> [2,] 101 220
>> [3,] 102 320
>> [4,] 103 420
>> [5,] 104 520
>> [6,] 105 620
> The above code does not produce the output you show when I
> paste it into R. It would be highly desirable to have a short,
> documented, working example...
>> So the result CANDS is 103, 104 and 105 b/c the corresponding DEVS are
>> larger than the DEV(400 in this case).
> How do they correspond? Do you mean they are both columns of a
> data.frame as your example output suggests? But CANDS and DEVS
> are of differnt length, so this is probably not what you meant.
> Finally, your code seems to indicate that you want all elements
> of CANDS for which the corresponding (?) value of DEVS is less
> than threshold DEV, but only if DEV>DEVS. The latter produces a
> warning, as you are comparing a single value to a vector of 5,
> which is most likely not what you want. At this point my
> confusion is perfect and I give up.
> I think you need to give us a better explanantion of what data
> you have and what exactly you want to accomplish.
> Dr. Philipp Pagel
> Lehrstuhl für Genomorientierte Bioinformatik
> Technische Universität München
> Wissenschaftszentrum Weihenstephan
> 85350 Freising, Germany
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
View this message in context: http://www.nabble.com/Conditionally-Removing-data-from-a-vector-tp20627244p20628349.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help