From 90b5e24a5d377469ccc5f150358599781be79244 Mon Sep 17 00:00:00 2001 From: Hsincho <99251348+xinzhuohkust@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:12:14 +0800 Subject: [PATCH] Update gov_website.R --- gov_website.R | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gov_website.R b/gov_website.R index 4b1df1b..4b10447 100644 --- a/gov_website.R +++ b/gov_website.R @@ -5,10 +5,8 @@ library(httr2) library(rio) done <- list.files("/home/runner/work/auto_web_crawling/auto_web_crawling/data/table", pattern = "csv", full.names = TRUE) %>% - map_dfr(~ import(., setclass = "tibble")) %>% - distinct(id, .keep_all = TRUE) %>% - mutate(across(everything(), as.character)) %>% - tibble() + map_dfr(~ import(., setclass = "tibble") |> mutate(across(everything(), as.character))) %>% + distinct(id, .keep_all = TRUE) extract_info <- possibly( insistently( @@ -62,9 +60,11 @@ for (i in 1:ceiling(total / 10)) { } table <- info[info != "error!"] %>% - map_dfr(\(x) fromJSON(x) |> pluck("body")) %>% - mutate(across(everything(), as.character)) %>% - tibble() + map_dfr( + \(x) fromJSON(x) |> + pluck("body") |> + mutate(across(everything(), as.character)) + ) export( table,