[R] How to read contents of a text file into a single string?

Paul Hiemstra p.hiemstra at geo.uu.nl
Wed Apr 28 17:05:22 CEST 2010


Dimitri Shvorob wrote:
> ... Both readLines() and scan() produce a number_of_lines x 1 vector; trying
> paste(s, collapse = NULL) leaves it unaffected. How can I concatenate vector
> elements (lines) into a single string? 
> Thank you.
>   
try collapse = ''

cheers,
Paul

-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770



More information about the R-help mailing list