Changing the row and column names of matrices with tools from base R (CC176)

Описание к видео Changing the row and column names of matrices with tools from base R (CC176)

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 find my blog post for this episode at https://www.riffomonas.org/code_club/....

The data were generated in our Kozich et al. 2013 paper (http://doi.org/10.1128/AEM.01043-13) using samples from the Schloss et al. 2012 paper (http://doi.org/10.4161/gmic.21008).

#attr #Rstats #baseR #str

Want more practice on the concepts covered in Code Club? You can sign up for my weekly newsletter at https://shop.riffomonas.org/youtube to get practice problems, tips, and insights.

If you're interested in taking an upcoming 3 day R workshop be sure to check out our schedule at https://riffomonas.org/workshops/

You can also find complete tutorials for learning R with the tidyverse using...
Microbial ecology data: https://www.riffomonas.org/minimalR/
General data: https://www.riffomonas.org/generalR/

0:00 Matrices are vectors with special attributes
1:30 Using the str and attributes functions
4:12 Using attr to get and set attributes of variables
5:59 Using specialized getter and setter functions
7:01 Changing attributes of a vector
11:43 Changing row and column names of a matrix
12:59 Creating custom attributes
14:00 Modifying attributes of our distance matrix

Комментарии

Информация по комментариям в разработке