Thanks to all who responded. Not all of the advice helped me with that particular problem, but, I have learned a lot just from your answers. 1. R for Mac 10 (Carbon version) uses the Mac convention of using ":" for the usual Unix "/" and thanks to Dr. Lumley for that since I'm new to R, Mac10, Macs in general, and Unix. 2. Interestingly, Dr. Ripley suggested to me not to use spaces in the path as R wouldn't be able to read them. I've found that on my Mac, spaces often come as default in file names. As long as I use the ":" (see 1) I can also use a space. I'm not sure of the Darwin/ Xwinows version of R. Looks like another Mac convention though. 3. The problem is partially solved: I never was able to read the data set I made with Mac's TextEdit. But, on entering the data at R's runtime window, I was able to write.table to an external file, shut down R and/or the computer, and come back later to read.table ... no problem. Perhaps TextEdit throws some extra code in, not sure <although I did save the data as simple text and fixed width format, really the only two options I could manipulate in TextEdit> I'll try Mac SimpleText (a Developer Tool) and emacs to see what happens with them. 4. Having fun with R! Thanks again for the help, if things with the text editors and read.table change I'll post my findings. Cheers, Jason Boyd graduate student University of Georgia College of Pharmacy 600 MHz 128 Mb iBook Mac OS 10.1, Fink & DevTools Carbonized R1.4.0 ***original message follows*** -------------- next part -------------- An embedded message was scrubbed... From: Ben Bolker <ben at zoo.ufl.edu> Subject: Re: [R] error in read.table on Mac OS 10 ... request for help Date: Tue, 19 Feb 2002 09:28:37 -0500 (EST) Size: 3890 Url: https://stat.ethz.ch/pipermail/r-help/attachments/20020219/fa4326d6/attachment.mht
Summary re: read.table on Mac OS 10
8 messages · Jason Boyd, Peter Dalgaard, Brian Ripley +1 more
1 day later
I am having the same problem (#3) with read.table on Darwin. The edit() function is not a work-around for me since I have to read an enormous text file. I tried copying the data from TextEdit and pasting it into vi and Project Builder, but that didn't help at all. I wonder if this is related to the MacOS convention of ending lines with "\l" instead of "\n". The strange thing is that read.delim() seems to work fine.
On Tuesday, February 19, 2002, at 06:22 ?, Jason Boyd wrote:
Thanks to all who responded. Not all of the advice
helped me with that particular problem, but, I have
learned a lot just from your answers.
1. R for Mac 10 (Carbon version) uses the Mac
convention of using ":" for the usual Unix "/" and thanks
to Dr. Lumley for that since I'm new to R, Mac10, Macs
in general, and Unix.
2. Interestingly, Dr. Ripley suggested to me not to use
spaces in the path as R wouldn't be able to read them.
I've found that on my Mac, spaces often come as
default in file names. As long as I use the ":" (see 1) I
can also use a space. I'm not sure of the Darwin/
Xwinows version of R. Looks like another Mac
convention though.
3. The problem is partially solved: I never was able to
read the data set I made with Mac's TextEdit. But, on
entering the data at R's runtime window, I was able to
write.table to an external file, shut down R and/or the
computer, and come back later to read.table ... no
problem. Perhaps TextEdit throws some extra code in,
not sure <although I did save the data as simple text
and fixed width format, really the only two options I
could manipulate in TextEdit> I'll try Mac SimpleText (a
Developer Tool) and emacs to see what happens with
them.
4. Having fun with R!
Thanks again for the help, if things with the text editors
and read.table change I'll post my findings.
Cheers,
Jason Boyd
graduate student
University of Georgia
College of Pharmacy
600 MHz 128 Mb iBook Mac OS 10.1, Fink & DevTools
Carbonized R1.4.0
***original message follows***
From: Ben Bolker <ben at zoo.ufl.edu>
Date: Tue Feb 19, 2002 09:28:37 X US/Eastern
To: Jason Boyd <BOYDJ at mail.rx.uga.edu>
Cc: R help list <r-help at stat.math.ethz.ch>
Subject: Re: [R] error in read.table on Mac OS 10 ... request for help
Reply-To: <bolker at zoo.ufl.edu>
I haven't seen any answers to this, so I'll try to provide some other
things to try (although I don't really know what's going on).
Try getwd() to see how paths appear to be specified internally. You
could also try setwd("/Users/Shared/rm140_FULL/work") before
read.table("..."). Also try list.files() to check out the file names.
It does seem you've been pretty thorough.
good luck,
Ben Bolker
On Fri, 15 Feb 2002, Jason Boyd wrote:
Hello, I'm a new user of R, and unsure of why I'm getting an error reading external files on my Mac OS 10 machine. I've read through posts that would seem related (and 'R Import/Export' and 'Introduction to R' as well as pertinent sections in V&R's 'Modern Applied Statistics with S-Plus') but to no avail. If anyone has any suggestions, I'd be very grateful. Here's the problem: When I enter the command:
idusc <- read.table(file = "/Users/Shared/
rm140_FULL/work/ioddupb.txt") I get the message: Error in file(file, "r") : cannot open file `/Users/Shared/ rm140_FULL/work/ioddupb.txt' This is the correct path according to my Finder window's "path" tab (that is, as far as Users is a folder under /) and also according to the command line interface (shell). I'm not sure why it can't read the file. I'm new to Unix systems also, so perhaps I've misunderstood paths (though I've been reading over Unix tutorials enough not to scare me). Other info: 1. the file was created in simple text mode in Mac TextEdit and saved fixed width text format. 2. when I save the file to another working directory under a different user, I also cannot read.table 3. I checked the priveleges of the .txt file, they were Read & write for the owner and Read for everyone else so that would seem to take care of R being able to copy it. 4. I also tried read.fwf with the same type error message. 5. The tutorials and examples as well as libraries all work fine, I can read data in the libraries, use add-on functions, and plot so it doesn't seem to be a problem with R itself. I'm sure this is just a simple matter but I'm perplexed. Thanks for any suggestions, Jason Boyd graduate student University of Georgia College of Pharmacy boydj at mail.rx.uga.edu -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R- FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help- request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. _._._._
-- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704
http://www.mcg.edu/research/biostat/bickel.html David R. Bickel, PhD Assistant Professor Medical College of Georgia Office of Biostatistics and Bioinformatics 1120 Fifteenth St., AE-3037 Augusta, GA 30912-4900 Tel.: 706-721-4697; Fax: 706-721-6294 E-mail: dbickel at mail.mcg.edu or bickel at prueba.info -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 5689 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/20020220/4ba11f03/attachment.bin
On Wed, 20 Feb 2002, David R. Bickel wrote:
I am having the same problem (#3) with read.table on Darwin. The edit() function is not a work-around for me since I have to read an enormous text file. I tried copying the data from TextEdit and pasting it into vi and Project Builder, but that didn't help at all. I wonder if this is related to the MacOS convention of ending lines with "\l" instead of "\n".
It's CR (ctrl-J, \r) as far as I know. Shouldn't be a problem. R's input handles all the standard line-ending conventions (LF, CRLF, CR) on all platforms, and this is tested as part of the test suite (although I don't know if that is run on MacOS).
The strange thing is that read.delim() seems to work fine.
and that calls read.table, so the problem is either with the separators or more likely with surplus separators at the end of lines in some lines. You can use a dump (use od under Unix) to find out what is really in the file. Neither of you have anywhere told us what the actual error message was in problem number 3.
On Tuesday, February 19, 2002, at 06:22 †, Jason Boyd wrote:
Thanks to all who responded. Not all of the advice helped me with that particular problem, but, I have learned a lot just from your answers. 1. R for Mac 10 (Carbon version) uses the Mac convention of using ":" for the usual Unix "/" and thanks to Dr. Lumley for that since I'm new to R, Mac10, Macs in general, and Unix. 2. Interestingly, Dr. Ripley suggested to me not to use spaces in the path as R wouldn't be able to read them.
y(That's not what I said. The posting by the time it reached me had a surplus newline and space in the file spec, at the end of a path component. R does handle legal file names including spaces. My comment as on the file spec as received, not in general.) [...]
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 21 Feb 2002, Prof Brian Ripley wrote:
On Wed, 20 Feb 2002, David R. Bickel wrote:
I am having the same problem (#3) with read.table on Darwin. The edit() function is not a work-around for me since I have to read an enormous text file. I tried copying the data from TextEdit and pasting it into vi and Project Builder, but that didn't help at all. I wonder if this is related to the MacOS convention of ending lines with "\l" instead of "\n".
It's CR (ctrl-J, \r) as far as I know.
(ctrl-M: this mail got sent in the middle of editing when my line went down ....) [...]
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof. Ripley,
I encountered the read.table problem in the Darwin version using
as.is=TRUE, but not with as.is=FALSE. It gives different results than
the Carbon version does. The output for each version follows; 'temp' is
a two-line text file with three tab-delimited columns.
UNDER DARWIN:
> read.table('temp')
V1 V2 V3
1 AFFX-BioB-5_at -214 -139
2 AFFX-BioB-M_at -49 -11
> read.table('temp',as.is=TRUE)
stack imbalance in internal type.convert, 26 then 25stack imbalance in
Internal, 25 then 24
stack imbalance in if, 19 then 18
stack imbalance in <-, 17 then 16
stack imbalance in {, 15 then 14
stack imbalance in for, 8 then 7
stack imbalance in {, 6 then 5
V1 V2 V3
1 AFFX-BioB-5_at -214 -139
2 AFFX-BioB-M_at -49 -11
Error: unprotect(): stack imbalance
UNDER CARBON:
> read.table('temp')
V1 V2 V3
1 AFFX-BioB-5_at -214 -139
2 AFFX-BioB-M_at -49 -11
> read.table('temp',as.is=TRUE)
V1 V2 V3
1 AFFX-BioB-5_at -214 -139
2 AFFX-BioB-M_at -49 -11
Best regards,
David
On Thursday, February 21, 2002, at 02:13 X, Prof Brian Ripley wrote:
Neither of you have anywhere told us what the actual error message was in problem number 3.
http://www.mcg.edu/research/biostat/bickel.html David R. Bickel, PhD Assistant Professor Medical College of Georgia Office of Biostatistics and Bioinformatics 1120 Fifteenth St., AE-3037 Augusta, GA 30912-4900 Tel.: 706-721-4697; Fax: 706-721-6294 E-mail: dbickel at mail.mcg.edu or bickel at prueba.info -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
"David R. Bickel" <dbickel at mail.mcg.edu> writes:
Prof. Ripley, I encountered the read.table problem in the Darwin version using as.is=TRUE, but not with as.is=FALSE. It gives different results than the Carbon version does. The output for each version follows; 'temp' is a two-line text file with three tab-delimited columns.
That was a (system-independent) bug in 1.4.0 and fixed in 1.4.1. Are you comparing identical versions?
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
That's not the current version of R. When you update to 1.4.1 you'll see the bug fix list includes this. It transpired that the posting earlier today about the speed of read.table on Darwin vs Carbon was also a difference in R version (1.4.0 vs 1.3.1). Please do tell us the R version(s) you are using when posting. Installing 1.x.1 to replace 1.x.0 is highly recommended, for all values of x.
On Thu, 21 Feb 2002, David R. Bickel wrote:
Prof. Ripley, I encountered the read.table problem in the Darwin version using as.is=TRUE, but not with as.is=FALSE. It gives different results than the Carbon version does. The output for each version follows; 'temp' is a two-line text file with three tab-delimited columns. UNDER DARWIN:
> read.table('temp')
V1 V2 V3 1 AFFX-BioB-5_at -214 -139 2 AFFX-BioB-M_at -49 -11
> read.table('temp',as.is=TRUE)
stack imbalance in internal type.convert, 26 then 25stack imbalance in
Internal, 25 then 24
stack imbalance in if, 19 then 18
stack imbalance in <-, 17 then 16
stack imbalance in {, 15 then 14
stack imbalance in for, 8 then 7
stack imbalance in {, 6 then 5
V1 V2 V3
1 AFFX-BioB-5_at -214 -139
2 AFFX-BioB-M_at -49 -11
Error: unprotect(): stack imbalance
UNDER CARBON:
> read.table('temp')
V1 V2 V3 1 AFFX-BioB-5_at -214 -139 2 AFFX-BioB-M_at -49 -11
> read.table('temp',as.is=TRUE)
V1 V2 V3 1 AFFX-BioB-5_at -214 -139 2 AFFX-BioB-M_at -49 -11 Best regards, David On Thursday, February 21, 2002, at 02:13 X, Prof Brian Ripley wrote:
Neither of you have anywhere told us what the actual error message was in problem number 3.
http://www.mcg.edu/research/biostat/bickel.html David R. Bickel, PhD Assistant Professor Medical College of Georgia Office of Biostatistics and Bioinformatics 1120 Fifteenth St., AE-3037 Augusta, GA 30912-4900 Tel.: 706-721-4697; Fax: 706-721-6294 E-mail: dbickel at mail.mcg.edu or bickel at prueba.info
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Unfortunately, 1.4.1 is not available from Fink and using "fink intall r-recommended" is the only way I have been able to successfully install R.
On Thursday, February 21, 2002, at 10:31 X, Prof Brian Ripley wrote:
That's not the current version of R. When you update to 1.4.1 you'll see the bug fix list includes this. It transpired that the posting earlier today about the speed of read.table on Darwin vs Carbon was also a difference in R version (1.4.0 vs 1.3.1). Please do tell us the R version(s) you are using when posting. Installing 1.x.1 to replace 1.x.0 is highly recommended, for all values of x. On Thu, 21 Feb 2002, David R. Bickel wrote:
Prof. Ripley, I encountered the read.table problem in the Darwin version using as.is=TRUE, but not with as.is=FALSE. It gives different results than the Carbon version does. The output for each version follows; 'temp' is a two-line text file with three tab-delimited columns. UNDER DARWIN:
read.table('temp')
V1 V2 V3 1 AFFX-BioB-5_at -214 -139 2 AFFX-BioB-M_at -49 -11
read.table('temp',as.is=TRUE)
stack imbalance in internal type.convert, 26 then 25stack imbalance in
Internal, 25 then 24
stack imbalance in if, 19 then 18
stack imbalance in <-, 17 then 16
stack imbalance in {, 15 then 14
stack imbalance in for, 8 then 7
stack imbalance in {, 6 then 5
V1 V2 V3
1 AFFX-BioB-5_at -214 -139
2 AFFX-BioB-M_at -49 -11
Error: unprotect(): stack imbalance
UNDER CARBON:
read.table('temp')
V1 V2 V3 1 AFFX-BioB-5_at -214 -139 2 AFFX-BioB-M_at -49 -11
read.table('temp',as.is=TRUE)
V1 V2 V3 1 AFFX-BioB-5_at -214 -139 2 AFFX-BioB-M_at -49 -11 Best regards, David On Thursday, February 21, 2002, at 02:13 X, Prof Brian Ripley wrote:
Neither of you have anywhere told us what the actual error message was in problem number 3.
http://www.mcg.edu/research/biostat/bickel.html David R. Bickel, PhD Assistant Professor Medical College of Georgia Office of Biostatistics and Bioinformatics 1120 Fifteenth St., AE-3037 Augusta, GA 30912-4900 Tel.: 706-721-4697; Fax: 706-721-6294 E-mail: dbickel at mail.mcg.edu or bickel at prueba.info
-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._