[Rd] multi.line=FALSE does not work in scan() (PR#1210)

vograno@arbitrade.com vograno@arbitrade.com
Tue, 11 Dec 2001 03:34:48 +0100 (MET)


The following applies to scan function called with multi.line=FALSE and
what=list(...).

If 'what' has more members than the number of columns in the file scan()
keeps reading from the next line of the file despite multi.line=FALSE. Here
is a transcript of the session:

# attempts to read four field whereas the file, foo, has only three per row
# This is the "foo" file
1 2.1 3.2
1 4.1 5.2
1 6.1 7.2

> x <- scan("foo", list(integer(0), double(0), double(0), integer(0)),
multi.line=FALSE)
Error in scan("foo", list(integer(0), double(0), double(0), integer(0)),  : 
	"scan" expected an integer, got "4.1"

# That an error will arise is expected, but not of this kind
# As a side note, it would be more informative if scan() printed the serial
number of the offending line (this is what S-Plus does).

> unlist(R.Version())
           platform                arch                  os
system 
"i686-pc-linux-gnu"              "i686"         "linux-gnu"   "i686,
linux-gnu" 
             status               major               minor
year 
                 ""                 "1"               "3.1"
"2001" 
              month                 day            language 
               "08"                "31"                 "R" 


Thank you for developing R,

Regards, Vadim

-------------------------------------------------- 
DISCLAIMER 
This e-mail, and any attachments thereto, is intended only for use by the
addressee(s) named herein and may contain legally privileged and/or
confidential information.  If you are not the intended recipient of this
e-mail, you are hereby notified that any dissemination, distribution or
copying of this e-mail, and any attachments thereto, is strictly prohibited.
If you have received this e-mail in error, please immediately notify me and
permanently delete the original and any copy of any e-mail and any printout
thereof. 

E-mail transmission cannot be guaranteed to be secure or error-free.  The
sender therefore does not accept liability for any errors or omissions in
the contents of this message which arise as a result of e-mail transmission.

NOTICE REGARDING PRIVACY AND CONFIDENTIALITY 

Knight Trading Group may, at its discretion, monitor and review the content
of all e-mail communications. 


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._