Dear Ramya, Try
# Gene list with 3 genes genelist=list(gene1=rnorm(100),gene2=rnorm(100),gene3=rnorm(100)) genelist # Map file with 50 genes mapfile=data.frame(gene=paste("gene",1:50,sep=""),coordinate=runif(50,61800000,63000000)) mapfile # Genes in genelist (names) NAMES=names(genelist) NAMES # Which genes' names of genelist are in mapfile which(NAMES%in%mapfile[,1]) # What are the names? NAMES[which(NAMES%in%mapfile[,1])] # mapfile information for those genes mapfile[which(NAMES%in%mapfile[,1]),] HTH, Jorge On Wed, Jul 2, 2008 at 11:37 AM, Rajasekaramya <[EMAIL PROTECTED]> wrote: > > hi > > I want to compare two list by its names and get the values of that list. > > can anybody let me know the syntax of comparing the list by their names > using a for loop > c.genes<- list() > for(i in 1:100) > > c.genes[[1]]<- geneset(which(geneset == tobecampared[i])) > > } > > here geneset is a list and also tobecampared is a list > > > Thank you > > Ramya > -- > View this message in context: > http://www.nabble.com/help-on-list-comparison-tp18240445p18240445.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > [[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.