Skip to content

Commit

Permalink
Check and reset original options()
Browse files Browse the repository at this point in the history
Define original options and reset at end of `get_GSOD` function

suggested by @jefferyhanson
  • Loading branch information
adamhsparks committed Oct 23, 2016
1 parent 8372844 commit 960bb82
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/get_GSOD.R
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,10 @@ get_GSOD <- function(years = NULL, station = NULL, country = NULL,
threads = 1) {

# Set up options, creating objects, check variables entered by user-----------
orginal_options <- options()
options(warn = 2)
options(timeout = 300)


# Set up tempfile and directory for downloading data from server
tf <- tempfile()
Expand Down Expand Up @@ -392,8 +394,7 @@ get_GSOD <- function(years = NULL, station = NULL, country = NULL,
# cleanup and reset to default state
unlink(tf)
unlink(td)
options(warn = 0)
options(timeout = 60)
options(original_options)
}

# Functions used within this package -------------------------------------------
Expand Down

0 comments on commit 960bb82

Please sign in to comment.