[R] skipping fields in scan()

Vadim Ogranovich vograno at arbitrade.com
Thu Jan 3 23:16:01 CET 2002


Dear R-Users,

Is it possible to instruct scan() to skip fields when reading from a file.
Here is an example. Suppose I have a three-column table file, "foo"

1 2 3
4 5 6

and I want to read in only the first and the third columns skipping the
second. If memory serves me well (though I might be wrong), in S-Plus you
could accomplish this by putting NULL in the respective position of the
list, e.g.

scan("foo", list(a=integer(0),NULL,c=integer(0)))

Is there a similar construct in R?

For a workaround I know I can read the whole thing and then drop the
unneeded column(s), or alternatively I can preprocess the file with a Perl
script, but before that I'd like to make sure there is no a more direct way
of doing this.

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



More information about the R-help mailing list