Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(r_can_connect_to_internet())
- {
- download_some_data(my_url)
- } else
- {
- warning("R cannot connect to the internet")
- get_local_data()
- }
- r_can_connect_to_internet <- function(test_url = "http://cran.r-project.org")
- {
- res <- try(readLines(test_url, n = 1), silent = TRUE)
- !inherits(res, "try-error")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement