> For the complete documentation index, see [llms.txt](https://docs.abi.am/abi-omicss-guide-2021/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.abi.am/abi-omicss-guide-2021/week-2/r-programming/subsetting.md).

# Subsetting

**Subsetting** in R is a useful indexing feature for accessing object elements. It can be used to select and filter variables and observations.

## Subsetting in R

To start learning about subsetting, watch the following videos from the Coursera page:

1. [Subsetting - Basics](https://www.coursera.org/learn/r-programming/lecture/JDoLX/subsetting-basics)
2. [Subsetting - Lists](https://www.coursera.org/learn/r-programming/lecture/hVKHm/subsetting-lists)
3. [Subsetting - Matrices](https://www.coursera.org/learn/r-programming/lecture/4gSc1/subsetting-matrices)
4. [Subsetting - Partial Matching](https://www.coursera.org/learn/r-programming/lecture/e284V/subsetting-partial-matching)
5. [Subsetting - Removing Missing Values](https://www.coursera.org/learn/r-programming/lecture/Qy8bH/subsetting-removing-missing-values)
6. [Vectorized Operations](https://www.coursera.org/learn/r-programming/lecture/nobfZ/vectorized-operations)

## swirl Exercises

Now, complete **swirl Lesson 6: Subsetting Vectors**, 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.abi.am/abi-omicss-guide-2021/week-2/r-programming/subsetting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
