Hi there,
Try this:
your.file=read.table(textConnection("<XML>
<TAG>
</TAG>
</XML>"),header=FALSE)
paste(your.file$V1,"\n",collapse="",sep="")
[1] "<XML>\n<TAG>\n</TAG>\n</XML>\n"
HTH,
Jorge
On Tue, Jun 17, 2008 at 1:01 PM, ppatel3026
<pratik.patel@us.rothschild.com>
wrote:
>
> How do you read in a whole file while preserving end of line "\n"
> characters?
> Basically, read in a whole file as one string.
>
> Ex:
> <XML>
> <TAG>
> </TAG>
> </XML>
>
> After this file is read into a variable, it should really look like
> "<XML>\n<TAG>\n</TAG>\n</XML>\n"
>
>
> --
> View this message in context:
>
http://www.nabble.com/Scan-document-including-%22%5Cn%22-tp17920810p17920810.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]