For slickness, I like DD <- merge(d1, d2)
assuming duplicate columns have identical labels. Mark Wilkinson Informatics Analyst St. Jude Children's Research Hospital Department of Pharmaceutical Sciences -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 17, 2002 9:47 AM To: [EMAIL PROTECTED] Subject: [R] Quick tip please! I have two CSV files (exported from Excel), say file1 and file2. The have the same number of rows, and each has several columns, with names on the first line; and some of the columns in file1 are repeated in file2. Using the "foreign" package, I can read these in separately to dataframes say d1 and d2 with > d1<-read.csv("file1") > d2<-read.csv("file2") Now I would like to combine these into a single dataframe D, notionally D <- "d1 on the left, d2 on the right" which contains all the columns except that duplicates only occur once (and, preferably, in the order of occurrence on d1 -- i.e. remove them from d2 if already dound in d1). Any tips for how to do this slickly? With thanks, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 167 1972 Date: 17-Dec-02 Time: 15:47:27 ------------------------------ XFMail ------------------------------ ______________________________________________ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help ______________________________________________ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
