Bug 16359 - read.csv corrupts connections
Summary: read.csv corrupts connections
Status: NEW
Alias: None
Product: R
Classification: Unclassified
Component: I/O (show other bugs)
Version: R 3.2.0
Hardware: x86_64/x64/amd64 (64-bit) Linux
: P5 normal
Assignee: R-core
Depends on:
Reported: 2015-05-01 09:19 UTC by Oliver Keyes
Modified: 2015-05-01 09:19 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Keyes 2015-05-01 09:19:48 UTC
If I read a file through a url() connection, it seems to close or corrupt the connection on the way out. This is non-ideal, since it leaves an invalid connection just sort of sitting there:

connection <- url("http://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.csv")
data <- read.csv(connection, as.is = TRUE)

Error in close.connection(connection) : invalid connection
Error in summary.connection(x) : invalid connection

The ideal behaviour is either (1) reading the file through doesn't do anything to the connection or (2) it explicitly closes the connection and has a more sensible error message than "this is invalid and that's all we're giving you".