[BioC] Basic question reading special chars using read.table

Yannick Wurm yannick.wurm at unil.ch
Tue Mar 31 18:08:14 CEST 2009


Hello David,

R doesnt like having names begin with numbers... hence the added X
It also thinks '-' means 'minus'...

So if you choose column names that have no "strange or possibly  
mathematical" characters inside them, you're safe

Also, if you have weird characters (eg, # or quotes or whitespace)  
read.table can fail to do what you expect from it... so whenever  
importing, check that your data is complete.


best,

yannick

--------------------------------------------
          yannick . wurm @ unil . ch
Ant Genomics, Ecology & Evolution @ Lausanne
   http://www.unil.ch/dee/page28685_fr.html


On Mar 31, 2009, at 17:47 , David martin wrote:

> The Header file (no quotes in the file):
> ########
> Gene    Coli-r1 1ug-r1  1ug-r2  Blank-r1
> ....	....	...	...	...
>
> ####reading the file
> t = read.table(file="file.txt",header=TRUE)
> colnames(t)
>
> [1] "Gene"     "Coli.r1"  "X1ug.r1"  "X1ug.r2"  "X1ug.r3"   "Blank.r1"
>
> As you can see the colname starting with a number are not treated  
> as i expected. An "X" is added ??? Also the "µ" is not handled  
> properly, i have replaced it with "u" in my example ???
>
> How come that the names of the columns are changed ??? how to avoid  
> that ???
>
>
> thanks for any help!
>
> david
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/ 
> gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list