I am trying to read a table from https://www.cdc.gov/nchs/pressroom/sosmap/cancer_mortality/cancer.htm.
I tried two ways, directly reading the csv file and using R package "rvest", but neither worked.
The following is my code:
url = "https://www.cdc.gov/nchs/pressroom/sosmap/cancer_mortality/cancer.htm"
## The csv file link
f = "blob:https://www.cdc.gov/32faf737-1355-4e1a-8b4f-a970820a290b"
# Way #1
rates1 = read.csv(file = f, header=TRUE, sep=",")
rates1
# Way #2
library("rvest")
rates2 = url %>% read_html() %>%
html_nodes(xpath='//*[@id="root"]/section/section[2]/div[2]/div[1]/div[2]') %>%
html_table(fill=TRUE) %>%
.[[1]]
rates2
Error messages:
cannot open file 'blob:https://www.cdc.gov/32faf737-1355-4e1a-8b4f-a970820a290b': No such file or directoryError in file(file, "rt") : cannot open the connection