# Functions

Functions play a critical role in any R program and you tend to write a lot of them while programming. This section focuses on functions in R.

## Functions in R

To start, watch the following videos outlining the concept of functions in R:

1. [Your First R Function](https://www.coursera.org/learn/r-programming/lecture/BM3dR/your-first-r-function)
2. [Functions (part 1)](https://www.coursera.org/learn/r-programming/lecture/LP1kF/functions-part-1)
3. [Functions (part 2)](https://www.coursera.org/learn/r-programming/lecture/2xbdl/functions-part-2)

## swirl Exercises

Complete **swirl Lesson 9: Functions**, to solidify what you just learned, and return here afterward.

## Congratulations!

If you made it here, then congratulations! You have successfully completed this section. Move to the next portion of the guide with the arrow buttons below.


---

# 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://docs.abi.am/abi-omicss-guide-2021/week-2/r-programming/functions.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.
