Hi, I am trying to write a function to read in a whole text file as a single string ( so I can calculate its "sha1" hash function using package "digest"). I need a single string containing the whole file, and so far I was using paste(readLines(fileName), collapse = ""). Unfortunately this function gives me warnings : incomplete final line found by readLines on 'test2.xml' due to lack of end-of-line character on the end of the file. Is there a way to suppress this warning? Or another function capable of reading whole text file into a string? Jarek =====================================\==== Jarek Tuszynski, PhD. o / \ Science Applications International Corporation <\__,| (703) 676-4192 "> \ Jaroslaw.W.Tuszynski@saic.com ` \ [[alternative HTML version deleted]]
Hello,
You can append an end-of-line character in your file doing :
> sink("test2.xml",append=TRUE)
> cat("\n")
> sink()
Romain
Le 26.05.2005 15:17, Tuszynski, Jaroslaw W. a ??crit :
>Hi,
>
>I am trying to write a function to read in a whole text file as a single
>string ( so I can calculate its "sha1" hash function using package
>"digest"). I need a single string containing the whole file, and
so far I
>was using paste(readLines(fileName), collapse = ""). Unfortunately
this
>function gives me warnings :
>
> incomplete final line found by readLines on 'test2.xml'
>
>due to lack of end-of-line character on the end of the file. Is there a way
>to suppress this warning? Or another function capable of reading whole text
>file into a string?
>
>Jarek
>=====================================\====
> Jarek Tuszynski, PhD. o / \
> Science Applications International Corporation <\__,|
> (703) 676-4192 "> \
> Jaroslaw.W.Tuszynski at saic.com ` \
>
>
>
--
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
~~~~~~ Romain FRANCOIS - http://addictedtor.free.fr ~~~~~~
~~~~ Etudiant ISUP - CS3 - Industrie et Services ~~~~
~~ http://www.isup.cicrp.jussieu.fr/ ~~
~~~~ Stagiaire INRIA Futurs - Equipe SELECT ~~~~
~~~~~~ http://www.inria.fr/recherche/equipes/select.fr.html ~~~~~~
~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
If its just a matter of suppressing the warning see: ?suppressWarnings On 5/26/05, Tuszynski, Jaroslaw W. <JAROSLAW.W.TUSZYNSKI at saic.com> wrote:> Hi, > > I am trying to write a function to read in a whole text file as a single > string ( so I can calculate its "sha1" hash function using package > "digest"). I need a single string containing the whole file, and so far I > was using paste(readLines(fileName), collapse = ""). Unfortunately this > function gives me warnings : > > incomplete final line found by readLines on 'test2.xml' > > due to lack of end-of-line character on the end of the file. Is there a way > to suppress this warning? Or another function capable of reading whole text > file into a string? > > Jarek > =====================================\===> Jarek Tuszynski, PhD. o / \ > Science Applications International Corporation <\__,| > (703) 676-4192 "> \ > Jaroslaw.W.Tuszynski at saic.com ` \ > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >