# 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):

![](/files/-LsbZaaSVTCUhxXdMWdZ)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nag-9-s.gitbook.io/r-programming/attach-function.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
