[R] Problem with subset
Luca Mortarini
l.mortarini at isac.cnr.it
Fri Jun 6 19:12:00 CEST 2008
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
More information about the R-help
mailing list