[R] question about scan()

Peter Baker (CMIS, Indooroopilly) Peter.Baker at csiro.au
Wed May 15 11:41:45 CEST 2002


On Tue, 14 May 2002 joshi at engr.orst.edu wrote:

>Hi,
>
>I am using the scan function to read from a file. In 
>general the syntax I am using is as follows:
>
>scan("myfile", list(a = "", b="", c="", d=""), sep=",")

try using  comment.char = "", as in
scan("myfile", list(a = "", b="", c="", d=""), sep=",", comment.char = "")

so that # isn't seen as a comment 
eg if its inside a string "abc#def" the string gets read properly

Regards
Peter

>
>The file I am trying to read contains a #< in the 'd' 
>field. When the file is read into an object, the d 
>field comes as "" for that particular string. 
>
>I guess the problem is because the # is used for 
>commenting. 
>My question is that if I want to read the #< anyways 
>from the file, how do I do that?
>
>Thanks in advance.
>-Saket.
>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>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
>_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
Dr Peter Baker, Statistician (Bioinformatics/Genetics),
CSIRO Mathematical & Information Sciences,
120 Meiers Rd, INDOOROOPILLY, QLD 4068.  Australia. 
Email: <Peter.Baker at csiro.au>
WWW: http://www.cmis.csiro.au/Peter.Baker/
Phone:+61 7 3214 2210   Fax:+61 7 3214 2881



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