Session Ready
Exercise

Extracting values

Just knowing the type of HTML object a node is isn't much use, though (although it can be very helpful). What we really want is to extract the actual text stored within the value.

We can do that with (shocker) html_text(), another convenient rvest function that accepts a node and passes back the text inside it. For this we'll want a node within the extracted element - specifically, the one containing the page title. The xpath value for that node is stored as second_xpath_val.

Using this xpath value, extract the node within table_element that we want, and then use html_text to extract the text, before printing it.

Instructions
100 XP
  • Extract the element of table_element referred to by second_xpath_val and store it as page_name.
  • Extract the text from page_name using html_text(), saving it as page_title.
  • Print page_title.