Search code examples
rhttr

Is it possible to have the GUI available while downloading a file in R?


Suppose one is downloading a pretty big file through httr. The download proceeds, but is somewhat slow. Is there any way of rendering the R GUI available while the download is in progress?

This is a working example. The file being downloaded is an example file.

library(httr)
ex <- "http://ipv4.download.thinkbroadband.com/1GB.zip"

httr::GET(ex, progress(), verbose(), write_disk(paste(getwd(), "example", sep = "/")))

Solution

  • I don't use Windows much, but I just tried clicking on the Rgui shortcut while another copy was running your download code, and it opened a new copy of the GUI that appeared to work.

    You'd want to be a bit careful doing this: changing the installed packages would likely cause trouble, and if you save your workspace at the end of a session (which is a bad idea), the second one you save will likely wipe out the first one.

    But the answer appears to be "yes, just open another copy".

    By the way, switching to RStudio is probably a good idea: it's a much better GUI than the one that ships with R. It has a menu item to open a new copy, you don't need to go looking for the shortcut.