Skip to content

RODBC excel - need to preserve (or extract) numeric column names

4 messages · Folkes, Michael, David Winsemius, Enrico Schumann

#
On Apr 4, 2011, at 6:05 PM, Folkes, Michael wrote:

            
read.table() (and perhaps read.csv) has a check.names argument which  
defaults to TRUE but can be set to FALSE. You will then need to take  
special care with the result, since those are not "safe" column names.

Another way would be to read only one line in with readLines and then  
assign to names(dfrm) which would be read in with `skip` = 1.
--

David Winsemius, MD
West Hartford, CT
#
At least for Excel 2003 on my computer (Win XP) I can "persuade" Excel to
treat cells like text by prepending a ' to the entry (eg, '1000). Then
sqlFetch/RODBC should import these cells as character. [But a number would
not be valid column name for a data.frame, and you may run into other
trouble. See ?make.names]

regards,
enrico
#
On Apr 5, 2011, at 4:53 AM, Enrico Schumann wrote:

            
If the problem is that Excel is failing to treat cells as text, then  
you could also try selecting the cells, then using the Format/Cells  
panel to specify "Text" rather than "General". But as I suggested  
before, I suspect the problem is you effort to defeat the usual  
checking for valid R names.