SUMMARY so far:
(1) export from excel to *.txt (tab-delimited) or *.csv (comma delimitted),
and use read.table to bring into Splus
This is my SOP, and how I started, but due to some problem with excel, or
with these files in excel, some rows with blank data are not appropriately
delimited (leading to a count fields error on import to Splus), so this
does not work in this case.
(2) Use File Import Data from menu. I tried this too, it gives the same
results as importData.
(3) Work around: I discovered that importData (or the drop-down menu
equivalent) fail to work only when the *first* row of data are blank
(missing), otherwise they work OK. When the first row is blank, it tries
to treat the relevant columns as factors (or strings, if you set
"stringsAsFactors=F"), and defaults to retain only three sig figures,
unless a specific cell format in Excel is set.
So one work around, in the case of missing data in the first row, is to
edit excel files with missing data in first row to have, eg., -9999, and
then later convert these to NA's.
In other words, NOT simple....
(or as David Thompson from Ontario put it: "Simple but deceptive, SOP in
MS world".)
Thanks,
-Scott
At 08:51 PM 5/25/2005, Scott Saleska wrote:
At least it SHOULD be simple:
Working in Splus6.2 for Win on Windows XP ServPak2
MS Excel 2002
I want to use importData to import 1 page of an excel file (17000x19) of
all numeric data (except header).
Missing data in the excel file is indicated by blank cells. At some
times, all data are missing for moderately long stretches, except for the
time indices in the first few columns.
PROBLEM 1: there seems to be no way to import this as numeric, turning
blank cells to NA. Instead the blanks make it treat these columns as
factors or strings.
OK, fine, import it as character, then convert all columns to numeric. A
needless pain, but it should work.
PROBLEM 2: It doesn't work. The characters as imported lose significant
digits. In most cases, only 3 sig digits are retained even if more are in
the excel file.
Any suggestions greatly appreciated.
-Scott
********
Scott R. Saleska, Ph.D.
NOTE NEW ADDRESS and EMAIL:
Assistant Professor, Ecology and Evolutionary Biology
University of Arizona
Tucson, AZ 85721
(520) 626-1500
saleska@email.arizona.edu
http://eebweb.arizona.edu/faculty/saleska/
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|