Question: I'm trying to load the table of Supreme Court Justices into R from the following URL.
<https://en.wikipedia.org/wiki/List_of_Justices_of_the_Supreme_Court_of_the_United_States>

I'm using the following code:

```
scotusURL <- "https://en.wikipedia.org/wiki/List_of_Justices_of_the_Supreme_Court_of_the_United_States"
scotusData <- getURL(scotusURL, ssl.verifypeer = FALSE)
scotusDoc <- htmlParse(scotusData)
scotusData <- scotusDoc['//table[@class="wikitable"]']
scotusTable <- readHTMLTable(scotusData[[1]], stringsAsFactors = FALSE)

```

R returns scotusTable as NULL. The goal here is to get a data.frame in R that I can use to make a ggplot of SCOTUS justice tenure on the Court. I previously had the script working to make an awesome plot, however after the recent decisions something changed on the page and now the script will not function. I went through the HTML on wikipedia to try to find any changes, however I'm not a webdev so anything that would break my script isn't immediately apparent.

Additionally, is there a method in R that would allow me to cache the data from this page so I'm not constantly referencing the URL? That would seem to be the ideal way to avoid this issue in the future.
Appreciate the help.

As an aside, SCOTUS in an on-going hobby/side-project of mine so if there's some other data source out there that's better than wikipedia, I'm all ears. 

Edit: Sorry I should have listed my dependencies. I'm using the XML, plyr, RCurl, data.table, and ggplot2 libraries.

Answer: 
You could try this:

```
url <- "https://en.wikipedia.org/wiki/List_of_Justices_of_the_Supreme_Court_of_the_United_States"
library(rvest) #v 0.2.0.9000
the_table <- read_html(url) %>% html_node("table.wikitable:nth-child(11)") %>% html_table()

```
For some reason the googlesheets dependency wasn't working, so I pulled it through google anyway. 

I ran:

```
=importhtml("https://en.wikipedia.org/wiki/List_of_Justices_of_the_Supreme_Court_of_the_United_States", "table", 2)

```

and then downloaded the file as a .csv

Don't know why I didn't think of that before. I'll have to re-write my string scripts to clean it up but this ended up being the best way to 1) fix the first problem I had and 2) download a file so that I don't have to keep referencing a URL.

Thanks for the help.