Skip to content
Prev 32261 / 398506 Next

Output to connections

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)

Henrik Bengtsson
http://azzalini.stat.unipd.it/

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help