1. Learn
  2. /
  3. Courses
  4. /
  5. Network Analysis in R

Connected

Exercise

Node attributes and subsetting

In this exercise you will learn how to add attributes to vertices in the network and view them.

Instructions

100 XP
  • Create a new vertex attribute called 'gender' from the vector genders using set_vertex_attr().
  • Create a new vertex attribute called 'age' from the vector ages using set_vertex_attr().
  • View all vertex attributes using vertex_attr().
  • View the attributes of the first five vertices in a dataframe using V(g)[[]].