[BioC] problem with read.table

Kasper Daniel Hansen khansen at stat.berkeley.edu
Wed Jul 23 06:20:09 CEST 2008


This does not make a whole lot of sense, since read.csv is a wrapper  
around read.table:

 > read.csv
function (file, header = TRUE, sep = ",", quote = "\"", dec = ".",
     fill = TRUE, comment.char = "", ...)
read.table(file = file, header = header, sep = sep, quote = quote,
     dec = dec, fill = fill, comment.char = comment.char, ...)
<environment: namespace:utils>

Notice the fill = TRUE argument, that is sometimes nice and sometimes  
catastrophic, depending on what file you are reading.

Kasper

On Jul 20, 2008, at 1:55 PM, Lynn Amon wrote:

> Hi Carol,
> I've had trouble with read.table also.  It doesn't always read all  
> the rows and columns.  I recommend using read.csv(sep="\t") instead.
> Lynn Amon
>
>
> Martin Morgan wrote:
>> carol white <wht_crl at yahoo.com> writes:
>>
>>
>>>                                                                               t 
>>>  = read.table ("my_file", check.names = FALSE, header =  
>>> T)                   gives the same result, modifying duplicate  
>>> names.                             Carol
>>
>> what does sessionInfo() say (i.e., is your R current; is this
>> something special to your OS or LOCALE)?  Have you done this in a
>> 'clean' R session, e.g., starting R from the shell with R --vanilla ?
>> And for what it's worth
>>
>>
>>> read.table("~/tmp/tmp.txt", header=TRUE, check.names=FALSE)
>>>
>>  AM2 AM2 AM2 FAL
>> 1   2   3   4   5
>> 2   1  -1  -3  -2
>>
>>
>>> sessionInfo()
>>>
>> R version 2.7.1 Patched (2008-07-03 r46033) x86_64-unknown-linux-gnu
>> locale:
>> LC_CTYPE 
>> = 
>> en_US 
>> .UTF 
>> -8 
>> ;LC_NUMERIC 
>> = 
>> C 
>> ;LC_TIME 
>> = 
>> en_US 
>> .UTF 
>> -8 
>> ;LC_COLLATE 
>> = 
>> en_US 
>> .UTF 
>> -8 
>> ;LC_MONETARY 
>> = 
>> C 
>> ;LC_MESSAGES 
>> = 
>> en_US 
>> .UTF 
>> -8 
>> ;LC_PAPER 
>> = 
>> en_US 
>> .UTF 
>> -8 
>> ;LC_NAME 
>> = 
>> C 
>> ;LC_ADDRESS 
>> =C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats     graphics  utils     datasets  grDevices methods    
>> base      Martin
>>
>>
>>> --- On Sat, 7/19/08, Martin Morgan <mtmorgan at fhcrc.org>  
>>> wrote 
>>> :                                                                                                        From 
>>> : Martin Morgan <mtmorgan at fhcrc.org>     Subject:  
>>> Re:                [BioC] problem with read.table     To: wht_crl at yahoo.com 
>>>      Cc:              bioconductor at stat.math.ethz.ch     Date:  
>>> Saturday, July 19, 2008,             1:52  
>>> PM 
>>>                                                                                                                                                                                                                                    Hi 
>>>   
>>> Carol 
>>> ...                                                                                                                                                                                                                          Carol 
>>>  white <wht_crl at yahoo.com>  
>>> writes 
>>> :                                                                                                                                                                                                   > 
>>>   
>>> Hi 
>>> ,                                                                                                                                                       > 
>>>  Although I set check.names to FALSE in read.table, the duplicate  
>>> names  
>>> get 
>>>                                                                                 modified 
>>> . What should be done in this  
>>> case 
>>> ?                                                                                                                 > 
>>>                                                                                                                                                            > 
>>>  the text file to be read by  
>>> read 
>>> .table 
>>>                                                                                                                     > 
>>>                                                                                                                                                            > 
>>>  AM2      AM2     AM2      
>>> FAL 
>>>                                                                                                                               > 
>>>  2                
>>> 3                                                             
>>> 4 
>>>                                                                                                                                                           5 
>>>                                                                                                                                                            > 
>>>  1               -1           -3         
>>> -2 
>>>                                                                                                                  > 
>>>                                                                                                                                                            > 
>>>  t = read.table ("my_file", check.names = F, header =  
>>> T 
>>> )                                                                                                                                                                                 Maybe 
>>>  spell out TRUE, FALSE (reserved words, cannot be assigned to)  
>>> to 
>>>                                                                                       avoid 
>>>  getting the value of variables T, F from your  
>>> environment 
>>> ??                                                                                                                                                                         Martin 
>>>                                                                                                                                                                                                                                     > 
>>> >  
>>> t 
>>>                                                                                                                                                         > 
>>>  AM2      AM2.1     AM2.2      
>>> FAL 
>>>                                                                                                                           > 
>>>                                                                                                                                                            > 
>>>  2               3              
>>> 4 
>>>                                                                                                                            5 
>>>                                                                                                                                                            > 
>>>                                                                                                                                                            > 
>>>  1               -1           -3         
>>> -2 
>>>                                                                                                                  > 
>>>                                                                                                                                                            > 
>>>  instead  
>>> of 
>>>                                                                                                                                                 > 
>>>                                                                                                                                                            > 
>>>  AM2      AM2     AM2     
>>> FAL 
>>>                                                                                                                                > 
>>>                                                                                                                                                            > 
>>>                                                                                                                                                            > 
>>>  2               3              
>>> 4 
>>>                                                                                                                            5 
>>>                                                                                                                                                            > 
>>>                                                                                                                                                            > 
>>>                                                                                                                                                            > 
>>>  1               -1           -3         
>>> -2 
>>>                                                                                                                  > 
>>>                                                                                                                                                            > 
>>>                                                                                                                                                            > 
>>>   
>>> Best 
>>> ,                                                                                                                                                     > 
>>>   
>>> carol 
>>>                                                                                                                                                      > 
>>>                                                                                                                                                            > 
>>>                                                                                                                                                            > 
>>>                                                                                                                                                            > 
>>>                                                                                                                                                            > 
>>>    [[alternative HTML version  
>>> deleted 
>>> ]]                                                                                                                    > 
>>>                                                                                                                                                            > 
>>>   
>>> _______________________________________________ 
>>>                                                                                                            > 
>>>  Bioconductor mailing  
>>> list 
>>>                                                                                                                                  > 
>>>   
>>> Bioconductor 
>>> @stat 
>>> .math 
>>> .ethz 
>>> .ch 
>>>                                                                                                                             > 
>>>                                                                               https 
>>> ://stat.ethz.ch/mailman/listinfo/ 
>>> bioconductor 
>>>                                                                                                          > 
>>>  Search the  
>>> archives 
>>> :                                                                                                                                      http 
>>> ://news.gmane.org/ 
>>> gmane 
>>> .science 
>>> .biology 
>>> .informatics 
>>> .conductor 
>>>                                                                                                                                                                          --                                                                                                                                                          Martin 
>>>   
>>> Morgan 
>>>                                                                                                                                                Computational 
>>>  Biology / Fred Hutchinson Cancer Research  
>>> Center 
>>>                                                                                               1100 
>>>  Fairview Ave.  
>>> N 
>>> .                                                                                                                                       PO 
>>>  Box 19024 Seattle, WA  
>>> 98109 
>>>                                                                                                                                                                                                             Location 
>>> : Arnold Building M2  
>>> B169 
>>>                                                                                                                            Phone 
>>> : (206) 667-2793
>>>
>>>
>>
>>
>
> _______________________________________________
> 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