How to get and set attributes of objects in R with the attr other functions (CC176)

January 6, 2022 • PD Schloss • 1 min read

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


You can browse the state of the repository at the