[R] Problems with read.table()
Gabor Grothendieck
ggrothendieck at myway.com
Mon Dec 22 15:11:38 CET 2003
I don't have Windows 98 to test it out but assuming
that it causes read.table to crash but not readLines,
you could try doing the preprocessing in R itself using
Simon's dedegree like follows to see if it works:
# dedegree is applied to text before it ever reaches read.table
con <- textConnection( dedegree( readLines("clipboard") ) )
read.csv2( con, header = T ) # is read.csv2 what you want?
(The above might be too slow if your file is very large
in which case use temporary anonymous files instead of
text connections.)
---
Date: Mon, 22 Dec 2003 09:52:30 -0000
From: Simon Fear <Simon.Fear at synequanon.com>
[ Add to Address Book | Block Address | Report as Spam ]
To: Helmut Kudrnovsky <hellik at web.de>, <r-help at stat.math.ethz.ch>
Subject: RE: [R] Problems with read.table()
This is a known bug (PR #3234), only affects Win98.
The problem is the degree sign (or any nonstandard ASCII)
in your first line (7SALNIG°)
Mostly you can actually read these things in OK, but R crashes
on printing. I get round it sometimes using something like
dedegree <- function(x) gsub("°", "deg", x)
applied to the "offending" variables after reading in.
Having said that, I, like you, have sometimes had the crash
on read (but not reproducibly as there are strict confidentiality
issues on my datasets). In that case you will have to edit the
data source file before reading it into R.
> -----Original Message-----
> From: Helmut Kudrnovsky [mailto:hellik at web.de]
> Sent: 22 December 2003 09:29
> To: r-help at stat.math.ethz.ch
> Subject: [R] Problems with read.table()
>
>
> Security Warning:
> If you are not sure an attachment is safe to open please contact
> Andy on x234. There are 0 attachments with this message.
> ________________________________________________________________
>
> R version 1.8.1, OS Windows 98
>
> Dear colleagues,
>
> if I import vegetation data (first row with column labels and
> first column
> with row labels) like
>
> 7MYRGERM;7AGRGIGA;7DRYOCTO;5MYRGERM;7SALELEA;7CHOCHON;7SALNIG°;.......
> t401;5;2;2;3;4;2;2;2;1;2;1;2;2;1;2;2;2;1;2;1;0;0;......
> t403;3;0;0;6;4;0;3;0;0;3;0;0;0;0;3;0;0;0;2;0;2;0;.....
>
> with read.table("data.file", header=TRUE, separator=";"), the
> R program
> crashes with following error message:
>
> RGUI verursachte einen Fehler durch eine ungültige Seite
> in Modul R.DLL bei 015f:6b515b87.
> Register:
> EAX=0075007a CS=015f EIP=6b515b87 EFLGS=00010246
> EBX=01bd3f57 SS=0167 ESP=0073ed20 EBP=0073ed48
> ECX=01bd3ad8 DS=0167 ESI=00000001 FS=2237
> EDX=ffffffb0 ES=0167 EDI=00000008 GS=0000
> Bytes bei CS:EIP:
> 0f b7 04 50 83 e0 08 eb ce 89 5d ec eb 8b 89 74
> Stapelwerte:
> 00000000 0073ee20 019ea008 00000007 00002000 0000003b
> 000000b0 0073ee20
> 00000006 01bd5f58 0073edb8 6b5162ef 00000010 00000001
> 0073ed8c 0073ee20
>
> with greetings from Tyrol
> Helmut Kudrnovsky
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
Simon Fear
Senior Statistician
Syne qua non Ltd
Tel: +44 (0) 1379 644449
Fax: +44 (0) 1379 644445
email: Simon.Fear at synequanon.com
web: http://www.synequanon.com
Number of attachments included with this message: 0
This message (and any associated files) is confidential and\...{{dropped}}
More information about the R-help
mailing list