aqua
aqua

Reputation: 647

Using read.fwf() with HTTPS

I'm trying to read the fixed-width file directly from the server, without downloading and writing a file and parsing it. If I do something like

> read.fwf(url("http://..."),columns)

then I get the response I want. However, with an HTTPS server I get this response.

> read.fwf(url("https://..."),columns)
Error in url("https://...") : 
  https:// URLs are not supported

With other formats, I've been able to use something like method="curl", but this doesn't seem to work with read.fwf().

Another approach I've tried was to download the file into memory using getURL() then parse it, which works for me with CSV files using read.csv(text=data), but read.fwf() doesn't seem to support this method.

Upvotes: 0

Views: 384

Answers (1)

Jeroen Ooms
Jeroen Ooms

Reputation: 32978

Have a look at the curl package:

The curl() function provides a drop-in replacement for base url() with better performance and support for http 2.0, ssl (https://, ftps://), gzip, deflate and other libcurl goodies.

Try:

library(curl)
read.fwf(curl("https://..."),columns)

Upvotes: 1

Related Questions