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

Renaud Lancelot renaud.lancelot at cirad.fr
Sat May 4 11:51:24 CEST 2002


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vill.zip
Type: application/x-zip-compressed
Size: 2106 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20020504/4b16ff33/vill.bin


More information about the R-help mailing list