[R] R crashes trying to read a data.frame

John Fox jfox at mcmaster.ca
Sat May 4 15:49:35 CEST 2002


Dear Renaud,

This seems to work OK for me, using the same version of R (1.5.0), but 
under Windows 2000:

 > vill <- read.table('c:/temp/vill.txt')
 > vill[50:54, ]
    codelieu    lati hemi   longi meri                       nom
50 SNKOLDJI 12.8436    N 15.0192    O Djida Marietou
51 SNKOLHAM 12.9519    N 14.8467    O SARE HAMIDOU
52 SNKOLKIS 12.9767    N 14.8714    O MARAKISSA
53 SNKOLLAM 12.8594    N 15.0219    O SARE LAMINE
54 SNKOLLAY 12.8275    N 14.8803    O DIOULAYEL
 > vill[ , 6]
   [1] Barkeyel 2                Mbar Mbacké
   [3] Barkeyel                  MBELA NDOCK
   [5] Mbossédji Bara            Tchiky
   [7] Darou Marnane             Ndiéghène Hibra
   [9] Ndock Peul                NGAR GUEYE
  [11] Gassel                    GUINGUINEO
  [13] Guinée Mass               Gniby
  [15] Gossas                    GOSSAS VILLAGE
  [17] Guinée Walo               Keur Ismaëla
  [19] Keur Ndiouga              Keur Cheickh Mbaye
  [21] Keur Mor Djité            Ndiénné Lagane
  [23] Ndock Diouma Léourou      Leyi
  [25] NDIOLOFENE                Mbadiène
  [27] MBOSS                     Meth
  [29] Moungouniane              Ndiayene Waly
  [31] Niangué                   Ndock Diouma Coumba
  [33] PETEGNE                   Panal Peul
  [35] Panal Thiarène            Sinthiou Thiénéba
  [37] NDINGLER TAWFEKH          THIADIA
  [39] Thiabédiène               SARE BAKARY
  [41] SARE BAMBA                SARE YORO BANA
  [43] SARE BIDJI                SARE BILALY
  [45] SARE BORY                 SARE BOUBEL
  [47] BANTHANGEL YORO DIAO      BANTHANTO DEMBA
  [49] SARE DIANAMBE             Djida Marietou
  [51] SARE HAMIDOU              MARAKISSA
  [53] SARE LAMINE               DIOULAYEL
  [55] MEDINA FASS               MAHON OUSMANE
  [57] MARAKISSA                 MEDINA SADIOUMA
  [59] DIANABO                   SINDIAN ADAMA
  [61] SAGHARE                   SARE SAMBOUDIANG
  [63] SANTANKOYE                SARE MAMADY
  [65] SARE SOUNKARY             WELIA DEMBEL
  [67] DIALACOUNA                KEUR DIANKO
  [69] KEUR MOUSSA BA            LEONA
  [71] NDIAYENE                  NDAKHAR KARIM
  [73] PADDAF 1                  PADDAF 2
  [75] PADDAF 3                  PADDAF 4
  [77] DIAGNE                    NDIOBEME SANTHIE
  [79] DIONABE                   GARKI
  [81] GUET ARDO                 KEUR MOUSSA KEBE
  [83] KEUR MANDOUMBE            NDEME
  [85] NOUFLE                    TOURE ATMANE
  [87] THIEMBAR                  TOURE FALL
  [89] THIALAGA                  THIALENE
  [91] THIAR PEULH               THIAR WOLOFF
  [93] Wadab‚ Nawar              Lampsar Peulh
  [95] Ouroube                   Madina
  [97] Ndiack Fall               Soutouboulbe
  [99] Sowanabes                 Ndiol
[101] Lampsar                   Thilène
[103] Diawar                    <NA>
[105] Ndombo                    Ngandiaye
[107] <NA>                      Thiago
Levels:  BANTHANGEL YORO DIAO      BANTHANTO 
DEMBA           Barkeyel                  Barkeyel 2                Darou 
Marnane             DIAGNE                    DIALACOUNA 
DIANABO                   Diawar                    DIONABE 
   DIOULAYEL                 Djida 
Marietou            GARKI                     Gassel 
Gniby                     Gossas                    GOSSAS 
VILLAGE            GUET ARDO                 Guinée 
Mass               Guinée Walo               GUINGUINEO                Keur 
Cheickh Mbaye        KEUR DIANKO               Keur 
Ismaëla              KEUR MANDOUMBE            Keur Mor 
Djité            KEUR MOUSSA BA            KEUR MOUSSA KEBE          Keur 
Ndiouga              Lampsar                   Lampsar 
Peulh             LEONA                     Leyi 
Madina                    MAHON 
OUSMANE             MARAKISSA                 Mbadiène 
Mbar Mbacké               MBELA 
NDOCK               MBOSS                     Mbossédji 
Bara            MEDINA FASS               MEDINA 
SADIOUMA           Meth                      Moungouniane 
NDAKHAR KARIM             NDEME                     Ndiack 
Fall               NDIAYENE                  Ndiayene 
Waly             Ndiéghène Hibra           Ndiénné 
Lagane            NDINGLER TAWFEKH          NDIOBEME 
SANTHIE          Ndiol                     NDIOLOFENE                Ndock 
Diouma Coumba       Ndock Diouma Léourou      Ndock 
Peul                Ndombo                    Ngandiaye 
NGAR 
GUEYE                Niangué                   NOUFLE 
Ouroube                   PADDAF 1                  PADDAF 
2                  PADDAF 3                  PADDAF 
4                  Panal Peul                Panal 
Thiarène            PETEGNE                   SAGHARE 
SANTANKOYE                SARE BAKARY               SARE 
BAMBA                SARE BIDJI                SARE 
BILALY               SARE BORY                 SARE 
BOUBEL               SARE DIANAMBE             SARE 
HAMIDOU              SARE LAMINE               SARE 
MAMADY               SARE SAMBOUDIANG          SARE 
SOUNKARY             SARE YORO BANA            SINDIAN 
ADAMA             Sinthiou 
Thiénéba         Soutouboulbe              Sowanabes                 Tchiky 
                    Thiabédiène               THIADIA 
Thiago                    THIALAGA                  THIALENE 
   THIAR PEULH               THIAR 
WOLOFF              THIEMBAR                  Thilène 
TOURE ATMANE              TOURE FALL                Wadab‚ 
Nawar              WELIA DEMBEL
 > vill[93, ]
    codelieu lati hemi longi meri                       nom
93 SNFLLWAD   NA   <NA>    NA   <NA> Wadab‚ Nawar
 >

R 1.5.0 appears to have some problems lining up the column names with the 
columns, though -- see the result of vill[93, ]. (I got a neater listing 
under 1.4.1).

I hope that this helps,
  John

At 10:51 AM 5/4/2002 +0100, Renaud Lancelot wrote:
>Dear all,
>
> > version
>          _
>platform i386-pc-mingw32
>arch     i386
>os       mingw32
>system   i386, mingw32
>status
>major    1
>minor    5.0
>year     2002
>month    04
>day      29
>language R
>
>OS: Win98
>
>I have a strange problem with a particular data.frame built with an SQL
>query in a database (package RODBC). The query is simple and the
>data.frame is small (108 rows * 6 columns). The problem does not seem to
>be related with the format of the data source: it occurs with 2
>different formats of the same table (MS Access and MS Visual FoxPro).
>
> > library(RODBC)
> > bd <- odbcConnect(dsn = "Baobab_VFP")
> > req <- "select * from lieu"
> > vill <- sqlQuery(channel = bd, query = req)
> > odbcClose(bd)
>[1] 1
> > dim(vill)
>[1] 108   6
>
>The problem is limited to the 6th column (which contains labels:
>character string, 2 missing values) and the 93th row. The particular
>values in this record do not seem to matter: they are not the same in
>the Access table and in the FoxPro table (tables are the same but order
>is different).
>
> > vill[50:54, ]
>    codelieu    lati hemi   longi meri                       nom
>50 SNKOLDJI 12.8436    N 15.0192    O Djida Marietou
>51 SNKOLHAM 12.9519    N 14.8467    O SARE HAMIDOU
>52 SNKOLKIS 12.9767    N 14.8714    O MARAKISSA
>53 SNKOLLAM 12.8594    N 15.0219    O SARE LAMINE
>54 SNKOLLAY 12.8275    N 14.8803    O DIOULAYEL
>
> > vill[93, 1:5]
>    codelieu lati hemi longi meri
>93 SNFLLWAD   NA   <NA>    NA   <NA>
>
> > vill[ , 6] # ===> crash
> > vill[93, ] # ===> crash
>
>I was able to write the whole data.frame in a text file with
>write.table(). I can read this text file with read.table() but R crashes
>as before at the same place:
>
> > write.table(vill, "d:\\vill.txt")
> > temp <- read.table("d:\\vill.txt")
>
> > temp[50:54, ]
>    codelieu    lati hemi   longi meri                       nom
>50 SNKOLDJI 12.8436    N 15.0192    O Djida Marietou
>51 SNKOLHAM 12.9519    N 14.8467    O SARE HAMIDOU
>52 SNKOLKIS 12.9767    N 14.8714    O MARAKISSA
>53 SNKOLLAM 12.8594    N 15.0219    O SARE LAMINE
>54 SNKOLLAY 12.8275    N 14.8803    O DIOULAYEL
>
> > temp[ , 6] # ===> crash
> > temp[93, ] # ===> crash
>
>Where does this come from ?
>
>For those interested, I attach the text file in a zip file (vill.zip,
>size = 3 ko)
>
>Thanks in advance,
>
>Renaud
>
>
>--
>Dr Renaud Lancelot, vétérinaire
>CIRAD, Département Elevage et Médecine Vétérinaire (CIRAD-Emvt)
>Programme Productions Animales
>http://www.cirad.fr/presentation/programmes/prod-ani.shtml
>
>ISRA-LNERV                      tel    (221) 832 49 02
>BP 2057 Dakar-Hann              fax    (221) 821 18 79 (CIRAD)
>Senegal                         e-mail renaud.lancelot at cirad.fr

-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list