CSHS-CWRA / CSHShydRology

Main package
GNU Affero General Public License v3.0
35 stars 39 forks source link

CRAN issue #6 changing user's options #74

Closed KevinShook closed 2 years ago

KevinShook commented 2 years ago

Please make sure that you do not change the user's options, par or working directory. If you really have to do so within functions, please ensure with an immediate call of on.exit() that the settings are reset when the function is exited. e.g.: ... oldpar <- par(no.readonly = TRUE) # code line i on.exit(par(oldpar)) # code line i + 1 ... par(mfrow=c(2,2)) # somewhere after ...

... old <- options() # code line i on.exit(options(old)) # code line i+1 ... options(scipen = 999) ... e.g.: If you're not familiar with the function, please check ?on.exit. This function makes it possible to restore options before exiting a function even if the function breaks. Therefore it needs to be called immediately after the option change within a function.

Please always make sure to reset to user's options(), working directory or par() after you changed it in examples and vignettes and demos. e.g.: inst/doc/hydrograph_plot.R oldpar <- par(mgp = c(2.5, 1, 0)) ... par(oldpar)

Session Info ```r ```
KevinShook commented 2 years ago

Fixed in ch_hydrograph_plot. However, the par values still need to be reset in: