as jim pointed out ( i think we were figuring this out simultaneously.
thanks a lot jim ), it looks it does have something to do with the
fact that it's a zoo object because below i consider two cases.
in the first case, fxdatab is a zoo object and i get the length of temp
to be 1.
in the second case, fxdatac is a matrix and the results in temp are
correct.
gabor : i really hate to bother you because i already do WAY too much so
if
unclass as jim figured out and then as.zooing afterwards with the
original index is what you suggest, that's fine with me.
#-----------------------------------------------------------------------
------------------------------------------------------------------------
----------------------------------
fxdatab<-structure(c(0,4,0,4,0,4,0,4),.Dim=c(4,2),.Dimnames =
list(c("1","2","3","4"),c("bid","ask")),
index=structure(c(1144049400,1144049400,1144049400,1144050402),class=c("
POSIXt","POSIXct"),tzone = ""),class="zoo")
print(fxdatab)
fxdatab<-fxdatab[(( fxdatab[,"bid"] > 0.0 ) & ( fxdatab[,"ask"] > 0.0
)),]
temp<-( fxdatab[,"bid"] > 0.0 ) & ( fxdatab[,"ask"] > 0.0 )
print(temp)
print(length(temp))
print(sum(temp))
#-----------------------------------------------------------------------
---
fxdatac<-structure(c(0, 4, 0, 4, 0, 4, 0, 4), .Dim = c(4, 2), .Dimnames
= list(
NULL, c("bid", "ask")))
print(fxdatac)
fxdatab<-fxdatac[(( fxdatab[,"bid"] > 0.0 ) & ( fxdatac[,"ask"] > 0.0
)),]
temp<-( fxdatac[,"bid"] > 0.0 ) & ( fxdatac[,"ask"] > 0.0 )
print(temp)
print(length(temp))
print(sum(temp))
--------------------------------------------------------
This is not an offer (or solicitation of an offer) to buy/sell the
securities/instruments mentioned or an official confirmation. Morgan Stanley
may deal as principal in or own or act as market maker for
securities/instruments mentioned or may advise the issuers. This is not
research and is not from MS Research but it may refer to a research
analyst/research report. Unless indicated, these views are the author's and
may differ from those of Morgan Stanley research or others in the Firm. We do
not represent this is accurate or complete and we may not update this. Past
performance is not indicative of future returns. For additional information,
research reports and important disclosures, contact me or see
https://secure.ms.com/servlet/cls. You should not use e-mail to request,
authorize or effect the purchase or sale of any security or instrument, to send
transfer instructions, or to effect any other transactions. We cannot
guarantee that any such requests received via !
e-mail will be processed in a timely manner. This communication is solely for
the addressee(s) and may contain confidential information. We do not waive
confidentiality by mistransmission. Contact me if you do not wish to receive
these communications. In the UK, this communication is directed in the UK to
those persons who are market counterparties or intermediate customers (as
defined in the UK Financial Services Authority's rules).
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.