[R] invalid connection with pipe()

Ali Tofigh alix.tofigh at gmail.com
Fri Mar 12 18:45:20 CET 2010


After using pipe() to view output in less, the pipe becomes invalid:

$ p <- pipe("less")
$ capture.output(1:100, file=p)
$ p
Error in summary.connection(x) : invalid connection
$ close(p)
Error in close.connection(p) : invalid connection

Is this a bug? Other uses of pipe works differently:

$ p <- pipe("echo 4711")
$ x <- scan(p)
Read 1 item
$ x
[1] 4711
$ p
description       class        mode        text      opened    can read
"echo 4711"      "pipe"         "r"      "text"    "closed"       "yes"
  can write
       "no"
$ close(p)
$ p
Error in summary.connection(x) : invalid connection

Cheers
/Ali



More information about the R-help mailing list