I am trying to extract the unemployment rate data from this site. In the form, there is a select
tag with some options. I can extract the table from default year 2007 to 2017. But I am having a hard time to set a value for from_year
and to_year
. Here is the code I have so far:
session = html_session("https://data.bls.gov/timeseries/LNS14000000")
form = read_html("https://data.bls.gov/timeseries/LNS14000000") %>% html_node("table form") %>% html_form()
set_values(form, from_year = 2000, to_year = as.numeric(format(Sys.Date(), "%Y"))) # nothing happened if I set the value for years
submit_form(session, form)
It doesn't work as expected.