[R] as.zoo question

From: Leeds, Mark (IED) <Mark.Leeds_at_morganstanley.com>
Date: Mon 30 Oct 2006 - 23:15:13 GMT


this is probably a question for gabor or achim but maybe someone else can answer it in case they are not around ?  

Ifr you paste the code below ( again you would need the zoo and chron libraries to be installed ),
you should get the error  

"Error in Ops.POSIXt(frequency, freq) : %% not defined for "POSIXt"
objects".  

What I want to do is take the numeric vector, lt, and turn it into a zoo object using
the index of bayesfactor ? but i think i am doing something wrong.  

maybe as.zoo expects something else other than a vector or maybe the elements of lt
 need to be unique ? it doesn't sound like lack of uniqueness is the problem
form the error. thanks to anyone who would bother to paste the code or could
tell me the problem.  

#-----------------------------------------------------------------------
------------------------------------------------------------------------

 

bayesfactor<-structure(c(0.133850433767341, 0.127505873914653,

0.097757994080402, 
0.324562703639163, 0.114562946148566, 0.283795371391936,
0.9678194561964, 
0.338586999584375, 0.135003441260579, 0.215395275848400,
0.327083442440481, 
0.164810629677337, 0.144040559454059, 0.181455513072478,
0.129252354959480, 
0.123264924228799, 0.325252571911978, 2.80852371783714,
0.809908249342204, 
0.624384923054961, 0.216870224939086, 0.157696528982145,
0.166016564358535, 
0.173687057125139, 0.150821633236067, 0.2430468137645,
0.854984063927109, 
0.241767533140137, 0.163060042017201, 0.495942843741025,
29.5233864009281, 

64.1263988614399, 80.5032273753947, 18.7433294450866, 2.37477344132821,
2.74811299975449, 8.6709767238735, 1.45810462283319, 0.641296294877387, 
0.532305913663132, 0.506016009063049, 0.714235796507194,
0.877754321270327, 
0.888167760154018, 0.908285299222526, 0.79698098937542,
0.573452272577509, 
0.8159526626772, 0.996710951332215, 0.887917149684703,
0.951644190080987, 
1.85771801589324, 3.49393985909198, 4.21174333281804, 3.81915573606739, 
4.22536274298039, 4.18355088851037, 4.42599684236279, 3.83974932512314, 
1.6996083496491, 1.01414288248082, 0.820775001454904, 0.76228386994647, 
1.06157643535834, 1.41500363895303, 1.66238340719379, 1.66459194376001, 
2.89941981293673, 3.12622131071540, 2.5453954903191, 2.28829891176501, 
2.18799931254973, 1.53144708705511, 1.39950525087250, 1.28050833200472, 
1.14952307627248, 1.14181384544291, 0.922409537373749,
0.935484555235005, 
0.901665993356154, 0.890055544480275, 0.868401571267226,
0.8677885803414, 
0.897604762926691, 0.841753954861793, 0.870938651757163,
0.81254996456992, 
0.814997777410166, 0.899730469158174, 0.93997787435783,
0.859961998580039, 
0.86795417554376, 0.897246596004909, 1.13008276895139, 1.24862389046983,

1.24486010790566, 1.1178505048961, 1.22854262450414, 1.35879837119693, 
1.7138940559014, 1.70018632820926, 1.42758456262715, 1.35841545310882, 
1.10609206096155, 1.17877367462301, 1.26894809654439, 1.27141596311207, 
1.27978970261800, 1.27354103448998, 1.31701136171458, 1.30050806806998, 1.28365731671798, 1.20664901565754), index = structure(c(1151904000,
1151904600, 1151905200, 1151905800, 1151906400, 1151907000, 1151907600, 
1151908200, 1151908800, 1151909400, 1151910000, 1151910600, 1151911200, 
1151911800, 1151912400, 1151913000, 1151913600, 1151914200, 1151914800, 
1151915400, 1151916000, 1151916600, 1151917200, 1151917800, 1151918400, 
1151919000, 1151919600, 1151920200, 1151920800, 1151921400, 1151922000, 
1151922600, 1151923200, 1151923800, 1151924400, 1151925000, 1151925600, 
1151926200, 1151926800, 1151927400, 1151928000, 1151928600, 1151929200, 
1151929800, 1151930400, 1151931000, 1151931600, 1151932200, 1151932800, 
1151933400, 1151934000, 1151934600, 1151935200, 1151935800, 1151936400, 
1151937000, 1151937600, 1151938200, 1151938800, 1151939400, 1151940000, 
1151940600, 1151941200, 1151941800, 1151942400, 1151943000, 1151943600, 
1151944200, 1151944800, 1151945400, 1151946000, 1151946600, 1151947200, 
1151947800, 1151948400, 1151949000, 1151949600, 1151950200, 1151950800, 
1151951400, 1151952000, 1151952600, 1151953200, 1151953800, 1151954400, 
1151955000, 1151955600, 1151956200, 1151956800, 1151957400, 1151958000, 
1151958600, 1151959200, 1151959800, 1151960400, 1151961000, 1151961600, 
1151962200, 1151962800, 1151963400, 1151964000, 1151964600, 1151965200, 
1151965800, 1151966400, 1151967000, 1151967600, 1151968200, 1151968800, 
1151969400, 1151970000, 1151970600, 1151971200), class = c("POSIXt", 

"POSIXct")), class = "zoo")
 

lt<-c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 1, 1, 1, 1, 1,

1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)

lt<-as.zoo(lt,index(bayesfactor))  

#-----------------------------------------------------------------------
------------------------------------------------------------------------
-------------------------------------------------------
--------------------------------------------------------

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]]



R-help@stat.math.ethz.ch 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 Tue Oct 31 10:21:00 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 30 Oct 2006 - 23:30:14 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.