I am new to web scraping in R and have recently ran into a problem with sites that reference javascript. I am attempting to scrape the data from a web page below and have been unsuccessful. I believe that the javascript links prevent me from accessing the table. As a result the R package "XML" with function "readHTMLTable" comes up null.
library(XML)
library(RCurl)
url <- "http://votingrights.news21.com/interactive/movement-voter-id/index.html"
tabs <- getURL(url)
tabs <- htmlParse(url)
tabs <- readHTMLTable(tabs, stringsAsFactors = FALSE)
How can I access the javascript links to get to the data? Or is this even possible? When using the direct link to the data (below) and the R package "rjson" I am still unable to read in the data.
library("rjson")
json_file <- "http://votingrights.news21.com/static/interactives/movement/data/fulldata.js"
lines <- readLines(json_file)
json_data <- fromJSON(lines, collapse="")