HI, May be this helps: dat <- read.table(text="GENEID Chrom 2211 x 2200 y 2412 xy 2456 x 2476 het",sep="",header=TRUE,stringsAsFactors=FALSE) subset(dat,Chrom=="x",select="GENEID") # GENEID #1 2211 #4 2456 A.K. Hello I have generated this script and got error in the subset line. genes<- read.table("Malph.txt", header=TRUE, row.names=1, sep="\t") subset(column=chrm,chrm=x) write.table(res, file="Geneschrom.txt", quote=FALSE, sep="\t") My data of genes is like this: GENEID Chrom 2211 x 2200 y 2412 xy 2456 x 2476 het I just want to print gene id with respect to chrom column.I want the gene ids where chrom is x. please help me