Re: [R] merge for data.frame and matrix

2010-05-13 Thread David Winsemius
On May 13, 2010, at 5:34 AM, Dennis Murphy wrote: Hi: You've got to convert m to a data frame first: Well, that would be one way, but it is not true that it is necessary. The Details section of the help page for merge says that row,names is an acceptable "by" specification, so without th

Re: [R] merge for data.frame and matrix

2010-05-13 Thread Dennis Murphy
Hi: You've got to convert m to a data frame first: > m <- data.frame(m) > m$nms <- rownames(m) > merge(df, m, by.x = 'col1', by.y = 'row.names') col1 col2.x col1 col2.y 1 kk 68 9 2 kk 38 9 HTH, Dennis On Wed, May 12, 2010 at 5:03 PM, Yuan Jian wrote: > Hello,