[R] Read.table for macs

David Orlovich david.orlovich at botany.otago.ac.nz
Thu Jan 23 10:34:03 CET 2003


Mikkel

As mentioned earlier it's a known, (now fixed) bug.

Last night I compiled a new copy of the R-1.6.2 source with the current 
patch set installed first and it works fine under Darwin/X11 on my 
(excellent) G4/400 Mac.

I just tried reading in a dummy file and it seems to read the file 
fine.  I put mixtures of letters and numbers in the test file as this 
was reported to be a problem.  Anyway it's pasted below and it is 
exactly the same as the dummy file I typed into Excel (v. X 10.1.3).  
So ... as far as I can see the patch works.  See below.  Cheers, David 
Orlovich.

[mushroom:~/R_work] orlovich% R

R : Copyright 2003, The R Development Core Team
Version 1.6.2 Patched (2003-01-21)

<snip>

 > test<-read.table("test.txt", header=T)
 > test
      sp1 sp2 sp3
tr3   43  56  56
tr4   43  58  4r
tr69  44  56  56
f4    45 r44  e3
h65   74  46   t
t65   56 ttw  54
h77   75  t4  45
t44   6r  5t  54




On Thursday, January 23, 2003, at 10:00 PM, Grum, Mikkel 
[IPGRI-SSA-Nairobi] wrote:

> Hamish,
>
> I suspect your problem might be with Excel.  try copying the data (and 
> just
> your data) to a clean spreadsheet and then save to a tab-delimited text
> file. Removes all sorts of unwanted invisible garbage.
>
> Then import into R with:
> 	test<-read.table("test.txt", header=T, sep="\t")
>
>
> Mikkel
>
>
>
> Hamish Callum wrote:
>
> Dear All,
>
> I've been using R for windows for a while, without too many problems.
> However, I'm forced to use the MAC OS system for teaching, because our
> teaching labs are mac only (not my idea!!). I have a very basic 
> problem,
> but one that doesn't appear on the FAQs. I simply want to import data
> from a spreadsheet. I'm using exactly what works fine on Windows, 
> namely:
>
> 1    save the file from Excel as tab-delimited, say called "test.txt",
> with the variable names in the first row.
> 2    Read in into R with
> Dear All,
>
> I've been using R for windows for a while, without too many problems.
> However, I'm forced to use the MAC OS system for teaching, because our
> teaching labs are mac only (not my idea!!). I have a very basic 
> problem,
> but one that doesn't appear on the FAQs. I simply want to import data
> from a spreadsheet. I'm using exactly what works fine on Windows, 
> namely:
>
> 1    save the file from Excel as tab-delimited, say called "test.txt",
> with the variable names in the first row.
> 2    Read in into R with
> test<-read.table("test.txt", header=T)
>
> It does weird things, especially if any variables are characters. For
> example, it has omitted the 5th observation for the 1st variable, and
> then appended it to the first variable name. I've tried read.csv with
> csv files, read.delim, etc. None seem to work. Am I being really silly,
> and if so, how do you do it? Or is there an easier way to get data into
> the mac port? Or is the mac port entirely useless?
>
> Can anyone out there help?
>
> Thanks
>
>
> It does weird things, especially if any variables are characters. For
> example, it has omitted the 5th observation for the 1st variable, and
> then appended it to the first variable name. I've tried read.csv with
> csv files, read.delim, etc. None seem to work. Am I being really silly,
> and if so, how do you do it? Or is there an easier way to get data into
> the mac port? Or is the mac port entirely useless?
>
> Can anyone out there help?
>
> Thanks
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
Dr David Orlovich
Department of Botany,
The University of Otago,
P.O. Box 56,
Dunedin,
New Zealand.

Phone +64 3 479 9060
Fax +64 3 479 7583
david.orlovich at botany.otago.ac.nz
david.orlovich at unix.net
http://www.botany.otago.ac.nz/




More information about the R-help mailing list