You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
The following does not work:
The reason seems to be that
read_table
first callsfwf_empty
, which opens the connection and reads from it; then it callscol_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 Gitmaster
ofread_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.
The text was updated successfully, but these errors were encountered: