From Adrian.Trapletti@wu-wien.ac.at  Fri Aug 13 14:15:42 1999
From: Adrian.Trapletti@wu-wien.ac.at (Adrian Trapletti)
Date: Fri, 13 Aug 1999 13:15:42 +0000
Subject: strange scan, count.fields
Message-ID: <37B41A7E.53104D7D@wu-wien.ac.at>

Does anybody understand what's going on here:

I have the following ascii file called "y.txt"


"USD-DEM" "USD-JPY" "DEM-JPY"
 0.344901 4.78712 4.442
 0.345715 4.7882 4.44189
 0.350657 4.79065 4.44177
 0.35347 4.79065 4.43616
 0.35368 4.78957 4.43622
 0.35361 4.78982 4.43669
 0.353821 4.79036 4.43622
 0.352767 4.78899 4.43634
 0.353119 4.78916 4.43545


In R I do the following:


wu161215{adrian}28: R

R : Copyright 1999, The R Development Core Team
Version 0.64.2  (July 3, 1999)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type    "?license" or "?licence" for distribution details.

R is a collaborative project with many contributors.
Type    "?contributors" for a list.

Type    "demo()" for some demos, "help()" for on-line help, or
        "help.start()" for a HTML browser interface to help.
Type    "q()" to quit R.

> x<-scan("y.txt")
Error: "scan" expected a real got ""USD-DEM""
> row.lens <- count.fields("y.txt")
> any(row.lens != row.lens[1])
[1] TRUE
>
> x<-scan("y.txt", skip=1)
Read 27 items
> row.lens <- count.fields("y.txt")
> any(row.lens != row.lens[1])
[1] FALSE
>


scan seems to produce some side-effect (not properly close the file?)
I am using Redhat 5.2 and in general R seems to be rather stable...

Thanks
Adrian

--
Adrian Trapletti, Vienna University of Economics and Business
Administration, Augasse 2-6, A-1090 Vienna, Austria
Phone: ++43 1 31336 4561, Fax: ++43 1 31336 708,
Email: adrian.trapletti@wu-wien.ac.at



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


strange scan, count.fields
Adrian Trapletti