0

Possible Duplicate:
Import text file as single character string

Is there a way to read a text file directly into a single string in R?

I am currently using readLines to split the file into lines and and then paste to collapse it into a string

profiletext <- paste(readLines("/etc/profile"), collapse="\n")

Is it possible to do this in one step?

(In python I would use the read function)

Community
  • 1
  • 1
Sameer
  • 1,807
  • 1
  • 15
  • 16
  • This question was recently addressed in [this post](http://stackoverflow.com/questions/9068397/import-text-file-as-single-character-string), which asked a question nearly identical to your own. – Josh O'Brien Mar 09 '12 at 18:04
  • Thanks for find that for me. I looked through previous questions but overlooked it. – Sameer Mar 09 '12 at 18:08
  • No problem. Thanks for having searched first before posting. – Josh O'Brien Mar 09 '12 at 18:14

0 Answers0