[R] not supressing leading zeros when reading a table?

Adrian Dusa dusa.adrian at gmail.com
Sun Jul 10 20:13:37 CEST 2005

Dear R list,

I have a dataset with a column which should be read as character, like this:

  name surname answer
1 xx   yyy     "00100"
2 rrr  hhh     "01"

When reading this dataset with read.table, I get
1 xx   yyy     100
2 rrr  hhh     1

The string column consists in answers to multiple choice questions, not all 
having the same number of answers. I could format the answers using formatC but 
there are over a hundred different questions in there.

I tried with quote="\"'" without any luck. Googling after this take me nowhere 
either. It should be simple but I seem to miss it...
Can anybody point me to the right direction?


More information about the R-help mailing list