Please reduce your examples down to small amounts of data and use dput so that they are reproducible.
On Wed, Jan 21, 2009 at 9:32 AM, Sergey Goriatchev <serg...@gmail.com> wrote: > Dear all, > > I have a zoo object that has following structure: > >> str(bldata) > zoo [1:5219, 1:12] 91.9 91.8 91.7 91.8 91.7 ... > - attr(*, "index")=Classes 'dates', 'times' atomic [1:5219] 7305 > 7306 7307 7308 7309 ... > .. ..- attr(*, "format")= chr "m/d/y" > .. ..- attr(*, "origin")= Named num [1:3] 1 1 1970 > .. .. ..- attr(*, "names")= chr [1:3] "month" "day" "year" > - attr(*, "dimnames")=List of 2 > ..$ : NULL > ..$ : chr [1:12] "ED4 COMDTY" "ED12 COMDTY" "ER4 COMDTY" "ER12 COMDTY" ... > > I also have a vector of dates of same length as zoo object (5219): > >> str(bldates) > chr [1:5219] "01/01/90" "01/02/90" "01/03/90" "01/04/90" "01/05/90" > "01/08/90" "01/09/90" "01/10/90" "01/11/90" "01/12/90" ... > > I do the following: > >> attributes(bldata)[[2]] <- as.Date(bldates, "%m/%d/%y") > > and get the following: > >> str(bldata) > 'zoo' series from 1990-01-01 to 2009-12-31 > Data: num [1:5219, 1:12] 91.9 91.8 91.7 91.8 91.7 ... > - attr(*, "dimnames")=List of 2 > ..$ : NULL > ..$ : chr [1:12] "ED4 COMDTY" "ED12 COMDTY" "ER4 COMDTY" "ER12 COMDTY" ... > Index: Class 'Date' num [1:5219] 7305 7306 7307 7308 7309 ... > > But what I really want to get is the following: > >>str(bldata) > 'zoo' series from 01/01/90 to 12/31/09 > Data: num [1:5219, 1:12] 91.9 91.8 91.7 91.8 91.7 ... > - attr(*, "dimnames")=List of 2 > ..$ : NULL > ..$ : chr [1:12] "ED4 COMDTY" "ED12 COMDTY" "ER4 COMDTY" "ER12 COMDTY" ... > Index: Classes 'dates', 'times' atomic [1:5219] 7305 7306 7307 7308 7309 ... > ..- attr(*, "format")= chr "m/d/y" > ..- attr(*, "origin")= Named num [1:3] 1 1 1970 > .. ..- attr(*, "names")= chr [1:3] "month" "day" "year" > > The array bldata is the same, only the last one is on a machine > running RBloomberg, and then I tried to save bldata (and rownames of > bldata in bldates) and > transfer bldata to the other machine which is not a Bloomberg > terminal, and the structure of bldata changes. > > What should I do in this case to adjust the structure? I guess I have > to somehow change the class of Index and set attributes of "Index" and > attribute "names" of attribute "origin" of attribute "Index"? > > Thank you for your help in advance! > > Regards, > Sergey > > -- > I'm not young enough to know everything. /Oscar Wilde > Experience is one thing you can't get for nothing. /Oscar Wilde > When you are finished changing, you're finished. /Benjamin Franklin > Tell me and I forget, teach me and I remember, involve me and I learn. > /Benjamin Franklin > Luck is where preparation meets opportunity. /George Patten > > ______________________________________________ > 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. > ______________________________________________ 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.