Hi #RStats. I often wish we had an R option/env var to indicate we're offline. Code could then *nicely* fall back to offline solutions. I lieu of a standard, can we come up with one here? I start by proposing: $ export R_OFFLINE=true > options(offline=TRUE) Other suggestions?
3
4
13
Or if anyone knows of non-R standards for this, please share. Maybe there's already some de facto standard for this in Linux, macOS, or MS Windows?
1
2
I have `isConnected` in package `dang` which does the trick---by trying to resolve Google (as a default, can be changed) and to open the page. As it relies only on base R itshould be portable enough. I am sure lots of people have similar helper functions. #rstats
1
2
5
Relying on base::url() alone is clever. As you might have seen elsewhere it this thread, I think testing for "offline" is different & much easier than testing for all possible types of "online". It's also free to check R_OFFLINE than to attempt a failed round trip
1
1
Replying to @henrikbengtsson
In theory, R_OFFLINE may work. In practice, someone who should have set ot may then have failed to do so. In practice, base::url() is orthogonal to all this, does not require other resources, folks, or coordination--and thus seems to work for me. #rstats

Apr 19, 2021 · 12:11 AM UTC

1
1
Replying to @eddelbuettel
base::url() only addresses HTTP, HTTPS, FTP, … protocols but not things like SSH, TCP connections, … I think R_OFFLINE can be the first line of defense, and set globally by those who know for sure, e.g. sysadms on air-gapped environments. Other techniques can be used as backup