r - Find min and max index where value is not Zero -


I have a vector that contains 8 elements

I want to return a point called vector in which Max and Min of Test Vector will be included, where the test can not be zero. That is, I do not want to be minimal or maximum

this is my code

  test & lt; - c (1,8,2,3,4,5, 0,7) test scores & lt; - c ((1: Length) ([test == minimum (test, no.rm = true) | test == max (test, no.rm = TRUE))   < p> Return score now  
  Integer (0)   

> I want to return the digits

  1 2   

Because 1 is the minimum index and 2 is the maximum index

< / div>

border and use the match code>, it's a custom Faster than function:

  vals = range (test [test! = 0]) match (wal, test)    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -