[R] Output to connections

Adelchi Azzalini azzalini at stat.unipd.it
Tue May 20 13:27:25 CEST 2003


On Tuesday 20 May 2003 13:03, Henrik Bengtsson wrote:
> In R '\' has to be escaped, i.e. '\\' which means '\\' has to be '\\\\'
> (this was probably there before the help page was generated!?)
>
> The following works
>
>   ## convert decimal point to comma in output, using a pipe (Unix)
>   zz <- pipe(paste("sed s/\\\\./,/ >", "outfile"), "w")
>   cat(format(round(rnorm(100), 4)), sep = "\n", file = zz)
>   close(zz)
>   ## now look at the output file:
>   file.show("outfile", delete.file = TRUE)

Yes, it works, thanks

Adelchi

-- 
Adelchi Azzalini  <azzalini at stat.unipd.it>
Dipart.Scienze Statistiche, Università di Padova, Italia
http://azzalini.stat.unipd.it/




More information about the R-help mailing list