---
layout: post
title: "How to get and set attributes of objects in R with the attr other functions (CC176)"
blurb: "How to change the data about your data"
author: "PD Schloss"
date: 2022-01-06 11:00
comments: false
youtube: yL3GfwSp0t4
start_hash: 12364b6b12caba562d5d0418a99d913a5bd80db0
end_hash: 8d53a5fa3c4da2e8d36f3d6e51279465ef0663dc
---

Being able to set and get attributes of objects in R is an important way to connect information to your data. In this episode of Code Club, Pat will show how to use the str, attr, and attributes functions to get and set attributes for vectors, matrices, and data frames. He'll also show that while these functions are powerful, there are specialized functions that allow you to change specific attributes and make things easier. Ultimately, we'll add sample names to a distance matrix that we've been working on in previous episodes. This is part of a series of videos demonstrating how to functions from base R to make these data compatible with tools from the tidyverse


<iframe style="margin: 0 auto;display:block;" width="560" height="315" src="https://www.youtube.com/embed/{{ page.youtube }}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>


## Code

You can browse the state of the repository at the
* [beginning of the episode](https://github.com/riffomonas/distances/tree/{{ page.start_hash }})
* [end of the episode](https://github.com/riffomonas/distances/tree/{{ page.end_hash }})
