Thanks Gabor. Just tried that... it didn't work for some reason, even though it also did not complain about an error this time.
> x[as.Date("2008-12-14")] 2008-12-14 NA > x[as.Date("2008-12-14")]<-1 > x[as.Date("2008-12-14")] 2008-12-14 NA > Regards, Tolga Tolga Uzuner Cross-Markets Chief Investments Office JP Morgan 6th Floor, 100 Wood Street London EC2V 7RF United Kingdom Asst. Lee Hesketh Tel: +44-20-77773303 Fax: +44-20-77422840 "Gabor Grothendieck" <ggrothendi...@gmail.com> 18/12/2008 04:07 To tolga.i.uzu...@jpmorgan.com cc r-help@r-project.org Subject Re: [R] replacing elements of a zoo object Remove the comma in the line with the error. On Wed, Dec 17, 2008 at 11:24 AM, <tolga.i.uzu...@jpmorgan.com> wrote: > Dear R Users, > > I am trying to do something quite simple: replace the elements of a zoo > object. For some reason, the following code does not seem to work. How can > I replace the value for the 14th of Dec of 2008 in the zoo object x below > with 1 (it is currently NA). > >> x > 2008-12-11 2008-12-12 2008-12-13 2008-12-14 2008-12-15 2008-12-16 > 361.667 389.875 NA NA 397.822 395.667 >> class(x) > [1] "zoo" >> class(index(x)) > [1] "Date" >> x[as.Date("2008-12-14"),] > 2008-12-14 > NA >> x[as.Date("2008-12-14"),]<-1 > Error in x[as.Date("2008-12-14"), ] <- 1 : > incorrect number of subscripts on matrix >> > > > Thanks in advance, > Tolga > > Generally, this communication is for informational purposes only > and it is not intended as an offer or solicitation for the purchase > or sale of any financial instrument or as an official confirmation > of any transaction. In the event you are receiving the offering > materials attached below related to your interest in hedge funds or > private equity, this communication may be intended as an offer or > solicitation for the purchase or sale of such fund(s). All market > prices, data and other information are not warranted as to > completeness or accuracy and are subject to change without notice. > Any comments or statements made herein do not necessarily reflect > those of JPMorgan Chase & Co., its subsidiaries and affiliates. > > This transmission may contain information that is privileged, > confidential, legally privileged, and/or exempt from disclosure > under applicable law. If you are not the intended recipient, you > are hereby notified that any disclosure, copying, distribution, or > use of the information contained herein (including any reliance > thereon) is STRICTLY PROHIBITED. Although this transmission and any > attachments are believed to be free of any virus or other defect > that might affect any computer system into which it is received and > opened, it is the responsibility of the recipient to ensure that it > is virus free and no responsibility is accepted by JPMorgan Chase & > Co., its subsidiaries and affiliates, as applicable, for any loss > or damage arising in any way from its use. If you received this > transmission in error, please immediately contact the sender and > destroy the material in its entirety, whether in electronic or hard > copy format. Thank you. > Please refer to http://www.jpmorgan.com/pages/disclosures for > disclosures relating to UK legal entities. > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org 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. > Generally, this communication is for informational purposes only and it is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. In the event you are receiving the offering materials attached below related to your interest in hedge funds or private equity, this communication may be intended as an offer or solicitation for the purchase or sale of such fund(s). All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.