R - Option (Global Options)

About

Global Option in R

Management

List

  • all options
list = options() 
  • one
(list|null)= options(optionName)

Get

getOption('optionName', default = NULL)

Set

  • Set the editor and save the previous value
old.o <- options(editor = "nedit")

If then

if(as.logical(getOption("performCleanp", TRUE)))
   cat("do cleanup\n")
   
# or
tmp <- getOption("performCleanup")
if(is.null(tmp))
  tmp <- TRUE
if(tmp)
   cat("do cleanup\n")   

Powered by ComboStrap