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
Replying to @henrikbengtsson
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

Apr 18, 2021 · 6:26 PM UTC

1
2
5
Replying to @eddelbuettel
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
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
1
1