-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from department-for-transport-public/orr_metho…
…dology Orr methodology
- Loading branch information
Showing
6 changed files
with
66 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#' For a provided ORR url, return those stats which have dynamically updating methodology links | ||
#' @name scrape_orr_methodology | ||
#' @param url URL of the ORR web page to scrape urls from | ||
#' @return a table containing two columns, the collection url and the methodology url | ||
#' @export | ||
#' @importFrom dplyr filter | ||
#' @importFrom purrr map list_rbind | ||
#' @importFrom magrittr "%>%" | ||
#' | ||
##Scrape the odd dynamic methodology | ||
scrape_orr_methodology <- function(url){ | ||
|
||
##Get the collection links | ||
links <- scrape_links(url) %>% | ||
##Turn into a data frame | ||
purrr::map(.f = ~tibble(methodology = .x)) %>% | ||
purrr::list_rbind(names_to = "element_number") %>% | ||
dplyr::filter(grepl("quality-report.pdf$", methodology, ignore.case = TRUE)) %>% | ||
dplyr::mutate(collection = url, | ||
methodology = paste0("https://dataportal.orr.gov.uk", methodology)) %>% | ||
dplyr::select(collection, methodology) %>% | ||
unique() | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.