[R] Excel to R

Bernardo Rangel tura tura at centroin.com.br
Sat Jul 15 16:50:14 CEST 2006


>Hi peolple!


I have a many excel tables with mode than 100 variables. And I want 
use R to analize that.

But I have a problem, a group of this variables (more than 50) in any 
table is a factor and other part is a number.

Tha factors variables have tha values enconde this form (1=Yes,2=No and 9 = NA)

Well I use this scripts to import the database

require(RODBC)
channel <- odbcConnectExcel("f:/teste.xls")
data <- sqlFetch(channel, "Sheet1")
  summary(data)
        qw              ee
  Min.   :1.000   Min.   :1.000
  1st Qu.:1.000   1st Qu.:1.500
  Median :1.000   Median :2.000
  Mean   :1.333   Mean   :2.429
  3rd Qu.:1.750   3rd Qu.:3.500
  Max.   :2.000   Max.   :4.000
  NA's   :1.000


But qw is a factor (and is colnum type isvtext)

Is possible modify my script for this utcome

 > summary(data)
     qw          ee
  1   :4   Min.   :1.000
  2   :2   1st Qu.:1.500
  NA's:1   Median :2.000
           Mean   :2.429
           3rd Qu.:3.500
           Max.   :4.000


Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil



More information about the R-help mailing list