[R] R 0.64.2 indexing

Peppy s.adi.purnomo at EnergyLink.co.nz
Wed Aug 18 23:31:30 CEST 1999


Hi,

> Say we have a large-sized vector of observation A and a time vector with
> the same size.  The latter vector basically is the time flag when ith
> obervation of A occurs, hence A[i] occurs at T[i].
> 
> I have no trouble with doing: T[A <= 10 | A >=20] for example
> 
> Now, what I am confused: I tried to pull out when the largest value of A
> with:
> 
> T[A == max(A, na.rm=TRUE)]
> 
> this statement comes up with a number of NA's although I activate the
> na.rm flag to TRUE.  the next thing I accidently type this:
> 
> T[A = max(A, na.rm=TRUE)]
> 
> with single "=", it works!! I thought logical "equal" is double equals,
> "==".  
> 
> Is that because I tried to pull out a value from a function so that I have
> to use single equal? and why does this work?
> 
Kindest Regards,
Peppy Adi-Purnomo

-------
Stephanus (Peppy) Adi-Purnomo
Energy Market Analyst  -  Energy Link Ltd - Dunedin
email: s.adi.purnomo at energylink.co.nz
http://www.energylink.co.nz

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list