[R] Read.table for macs

Grum, Mikkel [IPGRI-SSA-Nairobi] M.GRUM at CGIAR.ORG
Thu Jan 23 09:58:02 CET 2003


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




More information about the R-help mailing list