fix Rbuildignore issues and tidy package
This commit is contained in:
parent
d8326e4521
commit
1455a6256c
1 changed files with 26 additions and 19 deletions
|
|
@ -9,8 +9,8 @@ get_updated_cran_packages <- function(date = lubridate::today()) {
|
|||
feed <- get_cranberries_feed()
|
||||
|
||||
# Apply the function to each item and bind the results into a data frame
|
||||
results <- map(feed, ~ process_cranberries_rss(.x, date)) %>%
|
||||
list_rbind()
|
||||
results <- purrr::map(feed, ~ process_cranberries_rss(.x, date)) %>%
|
||||
purrr::list_rbind()
|
||||
|
||||
return(results)
|
||||
}
|
||||
|
|
@ -28,8 +28,8 @@ get_new_cran_packages <- function(date = lubridate::today()) {
|
|||
feed <- get_cranberries_feed(type = "new")
|
||||
|
||||
# Apply the function to each item and bind the results into a data frame
|
||||
results <- map(feed, ~ process_cranberries_rss(.x, date)) %>%
|
||||
list_rbind()
|
||||
results <- purrr::map(feed, ~ process_cranberries_rss(.x, date)) %>%
|
||||
purrr::list_rbind()
|
||||
|
||||
return(results)
|
||||
}
|
||||
|
|
@ -47,8 +47,8 @@ get_removed_cran_packages <- function(date = lubridate::today()) {
|
|||
feed <- get_cranberries_feed(type = "removed")
|
||||
|
||||
# Apply the function to each item and bind the results into a data frame
|
||||
results <- map(feed, ~ process_cranberries_rss(.x, date)) %>%
|
||||
list_rbind()
|
||||
results <- purrr::map(feed, ~ process_cranberries_rss(.x, date)) %>%
|
||||
purrr::list_rbind()
|
||||
|
||||
return(results)
|
||||
}
|
||||
|
|
@ -61,10 +61,10 @@ get_cranberries_feed <- function(type = "updated") {
|
|||
feed <- sprintf("https://dirk.eddelbuettel.com/cranberries/cran/%s/index.rss", type)
|
||||
|
||||
# Fetch and parse the RSS feed
|
||||
rss_content <- read_xml(feed)
|
||||
rss_content <- xml2::read_xml(feed)
|
||||
|
||||
# Extract item nodes
|
||||
items <- xml_find_all(rss_content, "//item")
|
||||
items <- xml2::xml_find_all(rss_content, "//item")
|
||||
|
||||
return(items)
|
||||
}
|
||||
|
|
@ -73,12 +73,11 @@ get_cranberries_feed <- function(type = "updated") {
|
|||
#' @importFrom xml2 xml_text xml_find_first
|
||||
#' @export
|
||||
process_cranberries_rss <- function(feed, date = lubridate::today()) {
|
||||
title <- xml_text(xml_find_first(feed, "title"))
|
||||
pub_date_text <- xml_text(xml_find_first(feed, "pubDate"))
|
||||
pub_date <- as_date(dmy_hms(pub_date_text))
|
||||
# pub_date_interval <- interval(head(pub_date), tail(pub_date))
|
||||
title <- xml2::xml_text(xml_find_first(feed, "title"))
|
||||
pub_date_text <- xml2::xml_text(xml_find_first(feed, "pubDate"))
|
||||
pub_date <- lubridate::as_date(dmy_hms(pub_date_text))
|
||||
if (class(date) == "Date") {
|
||||
date <- interval(date, date)
|
||||
date <- lubridate::interval(date, date)
|
||||
}
|
||||
|
||||
# browser()
|
||||
|
|
|
|||
Loading…
Reference in a new issue