readRDS(url) error

Hi,
I want to be able to load an R-file from an URL. This code worked before I updated my Mac os to catalina.

library(RCurl)
valence_model <- readRDS(url("https://oscarkjell.se/text_models/trained_anew1999_valence.rds"))

After the update I now get the following error:
Error in readRDS(url("https://oscarkjell.se/text_models/trained_anew1999_valence.rds")) :
error reading from connection

(The files does not seem to be corrupt since I can still load it with above code on another Mac that I have not updated the OS on yet. I've alos tried saving without any compression and rda-format )

Im using R version 3.6.2 (2019-12-12); and RStudio Version 1.2.5033.

Any help or solutions are much appreciated.
Oscar

Hi, and welcome.

Your code snippet is simple enough not to require a reproducible example, called a reprex, but it's good practice for more complicated issues.

The connection problem isn't limited to Catalina; it also occurs on Ubuntu 19.10. As you noted, the rds file is fine, which I confirmed by downloading and opening it with read, readRDS and readr::read_rds and to see, among others " model is based on the words and valence ratings".

I did notice that the parent directory is HTTP 413, which may or may not be relevant.

I did succeed on Catalina with

rio::import("https://oscarkjell.se/text_models/trained_anew1999_valence.rds")

although it was slow and produced a warning message.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.