Have you considered something like the following:
yr.day1 <- paste(df1$year, df1$day, sep=":")
yr.day2 <- paste(df2$year, df2$day, sep=":")
yr.day3 <- paste(df3$year, df3$day, sep=":")
common.dates <- intersect(yr.day1, intersect(yr.day2, yr.day3))
df1s <- df1[is.element(yr.day1, common.dates), ]
df2s <- df2[is.element(yr.day2, common.dates), ]
df3s <- df3[is.element(yr.day3, common.dates), ]
If the data frames all have the same column names, I'm not certain if
you even need the last 2 lines or what you want to do from here.
hope this helps. spencer graves
Lambert.Winnie wrote:
I know this is an easy question - I must be having a brain-blip. I am
using S-PLUS 6 on Windows XP. I have 3 data frames, each with the same
column names. I want to compare the Year and Day columns in all 3 and
get a resulting data frame with just the records that have the same Year
and Day combination in each data frame. I tried merge(df1, df2,
by=intersect(Year, Day)), but that didn't work. Am I at least on the
right track? Thanks for the help.
**********************************************
Winifred C. Lambert Senior Scientist/Meteorologist
ENSCO, Inc.
Aerospace Sciences and Engineering Division
1980 N. Atlantic Ave., Suite 230
Cocoa Beach, FL 32931
VOICE: 321.853.8130 FAX: 321.853.8415
EMAIL: lambert.winifred@ensco.com
AMU Quarterly Reports are available online:
http://science.ksc.nasa.gov/amu/home.html
********************************************
|