set_library_default_pos: Modify default attach position for 'base::library()'

View source: R/set_library_default_pos.R

set_library_default_posR Documentation

Modify default attach position for base::library()


This function is documented but not exported. Reach in with envir:::set_library_default_pos() to use it.


set_library_default_pos(..., after = NULL, before = NULL, value = NULL)



Ignored. Arguments must be named

after, before

string; the name of the environment on the search path that library() calls should by default attach after or before.


The value (or quoted expression) the new argument should be.


This is primarily a way to "pin" a particular environment on the search path. For example, say you have a "project_utils" environment where you've defined a variety of useful functions. To prevent future library() calls from masking any objects in your attached "project_utils" environment, you can modify the default pos argument to library.

attach_source("project_utils.R", name = "project_utils)
set_library_default_pos(after = "project_utils")
library(foo) # now foo will attach after the "project_utils" environment


The original default value of pos, invisibly

envir documentation built on Sept. 22, 2022, 5:07 p.m.