[R] Merging two data objects question
Leeds, Mark (IED)
Mark.Leeds at morganstanley.com
Thu May 31 21:44:12 CEST 2007
I have two R objects, allDataSubset1 and allDataSubset2 and the str of
both of them is shown below ( I don't show all 18 lists for
space purposes ). The difference between them is that the times ( and
possibly the days ) and the data is different and what I want to do is
merge them so that only the data in Subset2 that is the same day and
times as Subset 1 remains in the merged dataset. Obviously the
column names of Subset2 would have to changed to AUDB, CADB, CHFB etc
when they were merged ? I have no idea how to do this and originally
these 2 lists come from a zoo object so , if it's easier to merge the
zoo objects and then do the creation of the lists, that's okay also but
I don't know how to do that either. So, if someone wants me to send the
the str of the zoo objects, I can do that also. Thanks so much for any
help on this. It seems really complicated to me and I looked up merge
but it said that it works off of data frames ? Maybe I need to put them
in a data
frame but with all these lists of lists etc, I'm totally clueless on how
to do that.
[1] "STR OF allDataSubset1"
List of 18
$ 20050101: num [1:2565, 1:7] 20050103 20050103 20050103 20050103
20050103 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:7] "filedate" "AUD" "CAD" "CHF" ...
..- attr(*, "index")='POSIXct', format: chr [1:2565] "2005-01-03
08:04:00" "2005-01-03 08:08:00" "2005-01-03 08:12:00" "2005-01-03
08:16:00" ...
$ 20050201: num [1:2430, 1:7] 20050201 20050201 20050201 20050201
20050201 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:7] "filedate" "AUD" "CAD" "CHF" ...
..- attr(*, "index")='POSIXct', format: chr [1:2430] "2005-02-01
08:04:00" "2005-02-01 08:08:00" "2005-02-01 08:12:00" "2005-02-01
08:16:00" ...
$ 20050301: num [1:2970, 1:7] 20050301 20050301 20050301 20050301
20050301 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:7] "filedate" "AUD" "CAD" "CHF" ...
..- attr(*, "index")='POSIXct', format: chr [1:2970] "2005-03-01
08:04:00" "2005-03-01 08:08:00" "2005-03-01 08:12:00" "2005-03-01
08:16:00" ...
$ 20050401: num [1:2835, 1:7] 20050401 20050401 20050401 20050401
20050401 ...
#=======================================================================
=================================================================
List of 18
$ 20050101: num [1:10260, 1:7] 20050103 20050103 20050103 20050103
20050103 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:7] "filedate" "AUD" "CAD" "CHF" ...
..- attr(*, "index")='POSIXct', format: chr [1:10260] "2005-01-03
08:01:00" "2005-01-03 08:02:00" "2005-01-03 08:03:00" "2005-01-03
08:04:00" ...
$ 20050201: num [1:9720, 1:7] 20050201 20050201 20050201 20050201
20050201 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:7] "filedate" "AUD" "CAD" "CHF" ...
..- attr(*, "index")='POSIXct', format: chr [1:9720] "2005-02-01
08:01:00" "2005-02-01 08:02:00" "2005-02-01 08:03:00" "2005-02-01
08:04:00" ...
$ 20050301: num [1:11880, 1:7] 20050301 20050301 20050301 20050301
20050301 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:7] "filedate" "AUD" "CAD" "CHF" ...
..- attr(*, "index")='POSIXct', format: chr [1:11880] "2005-03-01
08:01:00" "2005-03-01 08:02:00" "2005-03-01 08:03:00" "2005-03-01
08:04:00" ...
$ 20050401: num [1:11340, 1:7] 20050401 20050401 20050401 20050401
20050401 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:7] "filedate" "AUD" "CAD" "CHF" ...
..- attr(*, "index")='POSIXct', format: chr [1:11340] "2005-04-01
08:01:00" "2005-04-01 08:02:00" "2005-04-01 08:03:00" "2005-04-01
08:04:00" ...
--------------------------------------------------------
This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}
More information about the R-help
mailing list