这是我用来从网站上删除文本的R代码。但我无法构建数据框,因为我想将信息导入csv文件。
library(rvest)
scraping_source <- read_html("https://www.vice.com/en_us/article/the-cost-of-being-a-drug-addict-in-canada")
scraping_source %>%
html_nodes("h2")
scraping_source %>%
html_nodes("h2") %>%
html_text()
scraping_source %>%
html_nodes("b")
scraping_source %>%
html_nodes("b") %>%
html_text()