[R] merge verctor and matrix

Peng, C cpeng.usm at gmail.com
Wed Sep 22 15:38:53 CEST 2010


>  v=data.frame(c1=c("e","r","t"),v=c(1,4,2) )
>  m=matrix(c("r","t","r","s","e",5,6,7,8,9),nr=5) 
>  colnames(m)=c("c1","c2")
>  m=as.data.frame(m)
>  merge(v, m, by ="c1" )
  c1 v c2
1  e 1  9
2  r 4  5
3  r 4  7
4  t 2  6

-- 
View this message in context: http://r.789695.n4.nabble.com/merge-verctor-and-matrix-tp2550280p2550315.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list