would someone be kind enough to paste the code below into an R session (
ir you
can paste it into a file and just source it ) and take a look at it ? I
must be doing something wrong but
i can't find it.
I start out with a zoo object that has 100 elements in it.
then, i only want to keep the rows in which the bid and the ask are both
grester than zero. ( maybe my logic is wrong there ? ).
i expected to get the full zoo object back after using the filter above
because all the bids and the asks are greater than zero.
yet, i'm nott getting the full data back. ( i actually started out with
a much much bigger object but i figured it would
be easier to deal with one hundred in this example ).
so, when i didn' get the full data back, i started putting my logic into
temp.
for some strange reason, when i sum temp or print it out or whateveer, i
get 54 elements. i think you will also if you run it.
i noticed this about 5 hours ago and i can't find my error. i don't
think it has to do with zoo. it must be my logic somehow but
i just don't see it and i don't know what else to do ?
you need to include the zoo library for below to work. ( and i think zoo
depends on chron so you would need that also ).
thanks a lot to anyone who is kind enough to take a look at this for me.
i really appreciate it.
the difficulty is that i don't et an error so i can't go any further
given my knowledge of R which isn't so great.
#-----------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
--------------------------------------------
fxdata<-structure(c(27.21, 27.21, 27.21, 27.21, 27.26, 27.25, 27.55,
27.5, 27.5, 27.5, 27.5, 27.52, 27.52, 27.52, 27.52, 27.58, 27.58,
27.58, 27.58, 27.62, 27.6, 27.6, 27.6, 27.65, 27.6, 27.6, 27.6, 27.6,
27.6, 27.57, 27.57, 27.57, 27.57, 27.57, 27.57, 27.57, 27.57, 27.57,
27.57, 27.57, 27.58, 27.58, 27.6, 27.58, 27.58,
27.6, 27.58, 27.58, 27.58, 27.59, 27.6, 27.59, 27.59, 27.58,
27.58, 27.58, 27.58, 27.58, 27.59, 27.58, 27.58, 27.59, 27.58,
27.59, 27.58, 27.6, 27.6, 27.58, 27.58, 27.58, 27.58, 27.58,
27.59, 27.58, 27.58, 27.58, 27.58, 27.58, 27.61, 27.61, 27.61,
27.61, 27.62, 27.62, 27.59, 27.61, 27.59, 27.59, 27.61, 27.61,
27.59, 27.59, 27.58, 27.58, 27.58, 27.58, 27.57, 27.57, 27.57,
27.58, 27.26, 27.26, 27.26, 27.26, 27.26, 27.26, 27.26, 27.65,
27.65, 27.58, 27.58, 27.58, 27.58, 27.58, 27.6, 27.6, 27.6, 27.62,
27.65, 27.65, 27.65, 27.66, 27.67, 27.67, 27.67, 27.66, 27.65,
27.65, 27.65, 27.65, 27.65, 27.65, 27.65, 27.65, 27.65, 27.63,
27.6, 27.6, 27.58, 27.6, 27.6, 27.65, 27.65, 27.65, 27.63, 27.63,
27.61, 27.6, 27.63, 27.63, 27.65, 27.65, 27.63, 27.63, 27.59,
27.59, 27.59, 27.63, 27.64, 27.64, 27.62, 27.62, 27.62, 27.62,
27.62, 27.62, 27.62, 27.62, 27.59, 27.59, 27.62, 27.62, 27.62,
27.62, 27.62, 27.62, 27.62, 27.62, 27.62, 27.63, 27.63, 27.63,
27.63, 27.63, 27.63, 27.63, 27.63, 27.62, 27.62, 27.62, 27.62,
27.62, 27.62, 27.62, 27.62, 27.62, 27.62, 27.58, 27.62, 27.62
), .Dim = c(100, 2), .Dimnames = list(c("1", "2", "3", "4", "5",
"6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16",
"17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27",
"28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38",
"39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49",
"50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60",
"61", "62", "63", "64", "65", "66", "67", "68", "69", "70", "71",
"72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "82",
"83", "84", "85", "86", "87", "88", "89", "90", "91", "92", "93",
"94", "95", "96", "97", "98", "99", "100"), c("bid", "ask")), index =
structure(c(1144049400,
1144049400, 1144049400, 1144050402, 1144050402, 1144050414, 1144051028,
1144051200, 1144051200, 1144051202, 1144051252, 1144051255, 1144051257,
1144051343, 1144051352, 1144051360, 1144051376, 1144051378, 1144051388,
1144051397, 1144051437, 1144051470, 1144051537, 1144051542, 1144051583,
1144051583, 1144051583, 1144051583, 1144051587, 1144051588, 1144051589,
1144051603, 1144051713, 1144051743, 1144051747, 1144051756, 1144052022,
1144052087, 1144052223, 1144052230, 1144052300, 1144052317, 1144052440,
1144052568, 1144052569, 1144052609, 1144052620, 1144052620, 1144052623,
1144052652, 1144052792, 1144052819, 1144052820, 1144052973, 1144052984,
1144052985, 1144052987, 1144053001, 1144053077, 1144053121, 1144053121,
1144053168, 1144053168, 1144054193, 1144054231, 1144054299, 1144054307,
1144054309, 1144054549, 1144054566, 1144054566, 1144054569, 1144054614,
1144054622, 1144054622, 1144054633, 1144054633, 1144054638, 1144054876,
1144054878, 1144054879, 1144054880, 1144054882, 1144054887, 1144054892,
1144054892, 1144054893, 1144054896, 1144054897, 1144054930, 1144054948,
1144054955, 1144055142, 1144055142, 1144055142, 1144055177, 1144055177,
1144055194, 1144055242, 1144055242), class = c("POSIXt", "POSIXct"
), tzone = ""), class = "zoo")
fxdata<-fxdata[(( fxdata[,"bid"] > 0.0 ) & ( fxdata[,"ask"] > 0.0 )),]
temp<-( fxdata[,"bid"] > 0.0 ) & ( fxdata[,"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.