[R] Extraction of few columns with desired values

arun smartpink111 at yahoo.com
Tue Mar 25 17:31:04 CET 2014


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



More information about the R-help mailing list