[R] as.data.frame question

Liaw, Andy andy_liaw at merck.com
Thu Jul 6 19:00:45 CEST 2006


You shouldn't need the as.data.frame(), as sqlFetch() already returns
a data.frame.  You could try adding the as.is argument to sqlFetch()
(see how it's specified in ?read.table), or else convert them
afterward.

Andy 

From: ruser ruser
>  
>    
>   I'm using the RODBC library to read in an Excel file using 
> the odbcConnectExcel function. I can read the Excel data 
> prefectly, however all my character variables get converted 
> to factors when using
>   my.data <- as.data.frame(sqlFetch(channel, "Sheet1"))
>    
>   I've tried using
>   my.data <- as.data.frame(I(sqlFetch(channel, "Sheet1")))
>    
>   but this creates just one column of data. Is there an 
> efficient way to read in the character variables from my 
> Excel data as characters rather than converting them to factors.
>    
>   Any help is much appreciated.
>    
>   Regards,
>    
>   Harry
>    
> 
>  		
> ---------------------------------
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>



More information about the R-help mailing list