[R] [FORGED] read.csv fails in R console in Ubuntu terminal but works in RStudio after R 3.6.3 upgrade to R 4.0.2?

Rolf Turner r@turner @end|ng |rom @uck|@nd@@c@nz
Wed Jul 15 23:15:24 CEST 2020


On 15/07/20 7:45 pm, Sam H wrote:

> Hi,
> 
> I am trying to download some data using read.csv and it works perfectly in
> RStudio and fails in the R console in the terminal in Ubuntu 18.04 after
> upgrading from R 3.6.3 to 4.0.2. Before upgrading this worked in the R
> console in the terminal also without any issues.
> 
> Why would that be? How to fix this?
> 
> Below please find R code output and sessionInfo().
> 
> *Works in RStudio*

<SNIP>

> *Fails in R console in terminal*
> 
>      > read.csv("https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=1&render=download",
> header=TRUE, as.is=TRUE, na="n/a")
> Error in file(file, "rt") :
>    cannot open the connection to
> 'https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=1&render=download'
> In addition: Warning message:
> In file(file, "rt") :
>    URL 'https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=1&render=download':
> status was 'Failure when receiving data from the peer'> traceback()3:
> file(file, "rt")2: read.table(file = file, header = header, sep = sep,
> quote = quote,
>         dec = dec, fill = fill, comment.char = comment.char, ...)1:
> read.csv("https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=1&render=download",
>         header = TRUE, as.is = TRUE, na = "n/a")>  sessionInfo()
> R version 4.0.2 (2020-06-22)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 18.04.4 LTS

<SNIP>

I'm running Ubuntu 18.04.4 and R 4.0.2.

When I tried the foregoing read.csv() command, it just hung; nothing 
happened until I hit <ctrl>-c; no output was returned (and no error 
message appeared).  However I was able to download the file 
"companylist.csv" from the site, and then read.csv() happily read that file.

I'm afraid that I have no insight into what's going on here, and 
certainly no insight into why Rstudio can read directly from the URL but 
raw R apparently can't.  Sorry.

Perhaps enquire of Rstudio and see if *they* have any insight.

cheers,

Rolf Turner

-- 
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-help mailing list