[R] readLines vs scan

Bert Gunter gunter.berton at gene.com
Sun Feb 12 16:35:19 CET 2012


Folks:

Suppose I wish to input a text file with variable length lines and
possible whitespace as is and then parse the resulting character
vector in R. Each line of text is terminated with "\n" (newline
character).

Is there any reason to prefer one or the other of:

scan (filename, what ="a",sep ="\n")  ##or
readLines(filename)

If it makes a difference, I'm on Windows.

Many thanks for any advice/insight.

-- 
Best,

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list