Create options for an r_process object

r_process_options(...)

Arguments

...

Options to override, named arguments.

Value

A list of options.

r_process_options() creates a set of options to initialize a new object from the r_process class. Its arguments must be named, the names are used as option names. The options correspond to (some of) the arguments of the r() function. At least the func option must be specified, this is the R function to run in the background.

Examples

## List all options and their default values:
r_process_options()
#> $func
#> NULL
#> 
#> $args
#> list()
#> 
#> $libpath
#> [1] "/tmp/Rtmp9VfyFP/temp_libpath3bdcaa7bf6fe6c"                                                                
#> [2] "/cluster-data/user-homes/elizabethb/projects/prism-pkgdocs-build/installed-pkgs/priority-3/callr_3.7.6_lib"
#> [3] "/opt/R/4.4.1/lib/R/library"                                                                                
#> 
#> $repos
#>                                                              RSPM 
#> "https://packagemanager.posit.co/cran/__linux__/jammy/2024-10-06" 
#>                                                     gh-pkg-mirror 
#>                "https://a2-ai.github.io/gh-pkg-mirror/2024-10-06" 
#>                                                              CRAN 
#>                                     "https://cloud.r-project.org" 
#> 
#> $stdout
#> [1] "|"
#> 
#> $stderr
#> [1] "|"
#> 
#> $poll_connection
#> [1] TRUE
#> 
#> $error
#> [1] "error"
#> 
#> $cmdargs
#> [1] "--slave"      "--no-save"    "--no-restore"
#> 
#> $system_profile
#> [1] FALSE
#> 
#> $user_profile
#> [1] "project"
#> 
#> $env
#> character(0)
#> 
#> $supervise
#> [1] FALSE
#> 
#> $load_hook
#>  [1] "{\n"                                                                                  
#>  [2] "    while (\"tools:callr\" %in% search()) detach(\"tools:callr\")\n"                  
#>  [3] "    env <- readRDS(\"/tmp/RtmpRcqRz3/callr-env-3bde437d409906\")\n"                   
#>  [4] "    do.call(\"attach\", list(env, pos = length(search()), name = \"tools:callr\"))\n" 
#>  [5] "    data <- env$`__callr_data__`\n"                                                   
#>  [6] "    data$pxlib <- data$load_client_lib(data$sofile[[paste0(\"arch-\", \n"             
#>  [7] "        .Platform$r_arch)]], data$pxdir)\n"                                           
#>  [8] "    options(error = function() invokeRestart(\"abort\"))\n"                           
#>  [9] "    rm(list = c(\"data\", \"env\"))\n"                                                
#> [10] "    lapply(c(\"R_ENVIRON\", \"R_ENVIRON_USER\", \"R_PROFILE\", \"R_PROFILE_USER\", \n"
#> [11] "        \"R_LIBS\", \"R_LIBS_USER\", \"R_LIBS_SITE\"), function(var) {\n"             
#> [12] "        bakvar <- paste0(\"CALLR_\", var, \"_BAK\")\n"                                
#> [13] "        val <- Sys.getenv(bakvar, NA_character_)\n"                                   
#> [14] "        if (!is.na(val)) {\n"                                                         
#> [15] "            do.call(\"Sys.setenv\", structure(list(val), names = var))\n"             
#> [16] "        }\n"                                                                          
#> [17] "        else {\n"                                                                     
#> [18] "            Sys.unsetenv(var)\n"                                                      
#> [19] "        }\n"                                                                          
#> [20] "        Sys.unsetenv(bakvar)\n"                                                       
#> [21] "    })\n"                                                                             
#> [22] "    Sys.unsetenv(\"CALLR_CHILD_R_LIBS\")\n"                                           
#> [23] "    Sys.unsetenv(\"CALLR_CHILD_R_LIBS_SITE\")\n"                                      
#> [24] "    Sys.unsetenv(\"CALLR_CHILD_R_LIBS_USER\")\n"                                      
#> [25] "}\n"                                                                                  
#> 
#> $extra
#> list()
#> 
#> $package
#> [1] FALSE
#> 
#> $arch
#> [1] "same"
#>