Try this: merge(rs.id, snp.id, by.x = 1, by.y = 2)$V2
or: with(snp.id, V2[match(rs.id, V3)]) On Thu, Oct 22, 2009 at 12:12 PM, Praveen Surendran <praveen.surend...@ucd.ie> wrote: > Hi, > > > > I have a vector with elements > > > > rs.id=c('rs100','rs101','rs102','rs103') > > > > And a dataframe 'snp.id' > > > > 1 SNP_100 rs100 > > 2 SNP_101 rs101 > > 3 SNP_102 rs102 > > 4 SNP_103 rs103 > > > > Task is to replace rs.id vector with corresponding 'SNP_' ids in snp.id. > > > > Thanks in advance. > > > > Praveen Surendran > > 2G, Complex and Adaptive Systems Laboratory (UCD CASL) > > School of Medicine and Medical Sciences > > University College Dublin > > Belfield, Dublin 4 > > Ireland. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.