-
Notifications
You must be signed in to change notification settings - Fork 290
Closed
Labels
Description
The following does not work:
con <- pipe("perl -le 'print qq{x $_} for 1..5'")
read_table(con)
## Error in isOpen(con) : invalid connection
The reason seems to be that read_table first calls fwf_empty, which opens the connection and reads from it; then it calls col_spec_standardise, which also tries to open the same connection & read from it. The latter fails because it's already been read from and can't be re-opened.
There's also another subsequent call to datasource (on line 47 in the current Git master of read_table.R) that would fail after this one.
In general, to support connections & pipes, each reading function should ensure that its file/connection is opened exactly once. Avoiding these re-opens should give better performance too.
Reactions are currently unavailable