[BioC] unique values for repeated geneIDs
Brad Chapman
chapmanb at 50mail.com
Fri Jun 11 21:07:51 CEST 2010
Hernando;
> I have this text file:
>
> A B C D
> d1 2 23 2
> d1 4 22 2
> d1 5 24 2
> d2 10 7 2
> d2 20 8 3
> d1 7 23 2
> d3 2 14 30
> d3 4 14 50
> d2 30 8 4
> d4 12 13 15
> d5 1 5 90
> d2 40 7 3
> d6 34 2 5
>
> > data<-read.table("test.txt",sep="\t")
> > agr<-aggregate(data[2:4], by=list(data$V1), FUN=mean)
>
> I get 21 warning messages and all the values are "NA", including
> header B, C, and D. However, if I remove A,B,C,D from the previous
> file, and type the same commands, it works perfectly fine, getting
> what I wanted.
Add header=TRUE to the read.table command:
data<-read.table("test.txt",sep="\t", header=TRUE)
agr<-aggregate(data[2:4], by=list(data$A), FUN=mean)
Try help(read.table) to learn more about the available options.
Brad
More information about the Bioconductor
mailing list