> For the complete documentation index, see [llms.txt](https://nag-9-s.gitbook.io/r-programming/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nag-9-s.gitbook.io/r-programming/attach-function.md).

# attach  function

<https://awakeningdatascientist.wordpress.com/2015/07/16/r-of-the-day-attach/>

The attach function in R is a powerful tool in base R that allows you to, well, attach a specific database to a search path. In other words, attach allows you to reference database variables without using the “$” extractor. For example, without using the attach function (using the Iris data set from R):

![](https://1672099015-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LsbZSeumAvJRqJJp15J%2F-LsbZ_LkURxIAxbBBJlv%2F-LsbZaaSVTCUhxXdMWdZ%2Fimport.png?generation=1572621937589455\&alt=media)
