[R] RODBC excel - need to preserve (or extract) numeric column names
David Winsemius
dwinsemius at comcast.net
Tue Apr 5 00:33:27 CEST 2011
On Apr 4, 2011, at 6:05 PM, Folkes, Michael wrote:
> I'm using RODBC to read an excel file (not mine!). But I'm
> struggling to find a way to preserve the column names that have a
> numeric value. sqlFetch() drops the value and calls them f1, f2,
> f3,... (ie field number). this is a different approach from
> read.csv, which will append "V" prior to the numeric column name.
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.
> sqlFetch isn't so helpful.
>
> Is there a way to get the first line of data from the excel file and
> place it in a vector? Perhaps I can use that method and rename the
> dataframe column names later?
>
> thanks!
> Michael
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list