[Rd] read.table with ":" in column names (PR#8511)

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Fri Jan 20 12:14:24 CET 2006


Please do not report documented behaviour as a bug!
See the 'check.names' argument to read.table.

In your second example you are applying as.character to a data frame, and 
you seem not to realize that.  We specifically ask you NOT to use R-bugs 
to ask questions.  (What is happening is that you got the internal codes 
of the factor columns, which is not what you intended.  If you want 
character columns, read them as such.)

On Fri, 20 Jan 2006 peverlorenvanthemaat at amc.uva.nl wrote:

> Full_Name: emiel ver loren
> Version: 2.2.0

We do ask you not to send reports on obselete versions of R.

> OS: Windows XP
> Submission from: (NULL) (145.117.31.248)
>
>
> Dear R-community and developers,
>
> I have been trying to read in a tab delimeted file where the column names and
> the row names are of the form "GO:0000051" (gene ontology IDs). When using:
>
>> gomat<-read.table("test.txt")
>> colnames(gomat)[1]
> [1] "GO.0000051"
>> rownames(gomat)[1]
> [1] "GO:0000002"
>
> Which means that ":" is transformed into a "." !! This seems like Excel when it
> is trying to guess what I am really ment (and turning 1/1/1 into 1-1-2001).
>
> Furthermore, I found the following quite strange as well:
>
>> gomat2<-read.delim2("test.txt",header=FALSE)
>> gomat2[1,1:2]
>          V1         V2
> 1 GO:0000051 GO:0000280
>>  as.character(gomat2[1,1:2])
> [1] "8" "2"
>> as.character(gomat2[1,1])
> [1] "GO:0000051"
>
> I have found a way to work around it, but I am wandering what's happening....
>
> The tab-delimited file look like:
>
> GO:0000051	GO:0000280	GO:0000740
> GO:0000002	0	0	0
> GO:0000004	0	0	0
> GO:0000012	0	0	0
> GO:0000014	0	0	0
> GO:0000015	0	0	0
> GO:0000018	0	0	0
> GO:0000019	0	0	0
>
> Thanks for helping, and
>
> Emiel
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list