library(tidyverse)
library(rvest)
fruits <- read_html(";)
fruits_df <- fruits %>%
html_elements("._product") %>%
map_dfr(~ tibble(
product = .x %>%
html_element("._product-name-tag a") %>%
html_text2(),
price = .x %>%
html_element("._product-price-inner span") %>%
html_text2(),
price_old = .x %>%
html_element("._product-price-old") %>%
html_text2(),
unit = .x %>%
html_element("._button_unit") %>%
html_text2())) %>%
mutate(date = Sys.Date(),
type = "Fruits and vegetables",
source = "T MARKET", .before = product) %>%
mutate(price = str_replace(price, ",", "."),
price = parse_number(price),
) %>% distinct()
When running this code I'm getting the following error:
Error in open.connection(x, "rb") : cannot open the connection
Can anyone suggest a clue? Thanks!
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744838181a4596391.html
评论列表(0条)