[R] Problem with subset

From: Luca Mortarini <l.mortarini_at_isac.cnr.it>
Date: Fri, 06 Jun 2008 19:12:00 +0200 (CEST)


Hi,

     I am new to R and i am looking for a way to extract a subset from a vector.
I have a vector of number oscillating around zero (a decreasing autocorrelation function) and i would like to extract only the first positive part of the function (from zero lag to the lag where the function inverts its sign for the first time).
I have tried

subset(myvector,myvector>0)

but this obviously extract all the positive intervals not only the first one.  Is there a logical statement i can use in subset? I prefer not to use an if statement that would probably slow down the code. Thanks a lot,

                          Luca


*********************************************************
dr. Luca Mortarini               l.mortarini_at_isac.cnr.it
UniversitÓ del Piemonte Orientale
Dipartimento di Scienze e Tecnologie Avanzate

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 06 Jun 2008 - 18:50:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 06 Jun 2008 - 19:30:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive