export functions
This commit is contained in:
parent
0946ae89ee
commit
d8326e4521
1 changed files with 11 additions and 3 deletions
|
|
@ -4,7 +4,7 @@
|
|||
#' @importFrom lubridate today
|
||||
#' @examples
|
||||
#' get_updated_cran_packages(lubridate::interval(today() - 7, today()))
|
||||
#'
|
||||
#' @export
|
||||
get_updated_cran_packages <- function(date = lubridate::today()) {
|
||||
feed <- get_cranberries_feed()
|
||||
|
||||
|
|
@ -19,6 +19,7 @@ get_updated_cran_packages <- function(date = lubridate::today()) {
|
|||
#' @importFrom magrittr %>%
|
||||
#' @importFrom purrr map list_rbind
|
||||
#' @importFrom lubridate today
|
||||
#' @export
|
||||
#' @examples
|
||||
#' # last week
|
||||
#' get_new_cran_packages(lubridate::interval(today() - 7, today()))
|
||||
|
|
@ -37,6 +38,7 @@ get_new_cran_packages <- function(date = lubridate::today()) {
|
|||
#' @importFrom magrittr %>%
|
||||
#' @importFrom purrr map list_rbind
|
||||
#' @importFrom lubridate today
|
||||
#' @export
|
||||
#' @examples
|
||||
#' get_removed_cran_packages()
|
||||
#' get_removed_cran_packages(lubridate::interval(today() - 7, today()))
|
||||
|
|
@ -53,6 +55,7 @@ get_removed_cran_packages <- function(date = lubridate::today()) {
|
|||
|
||||
#' Get Cranberries fieed
|
||||
#' @importFrom xml2 read_xml xml_find_all
|
||||
#' @export
|
||||
#' @param type Which type of packages to query. Allowed are `"updated"`, `"new"` and `"removed"`
|
||||
get_cranberries_feed <- function(type = "updated") {
|
||||
feed <- sprintf("https://dirk.eddelbuettel.com/cranberries/cran/%s/index.rss", type)
|
||||
|
|
@ -68,6 +71,7 @@ get_cranberries_feed <- function(type = "updated") {
|
|||
|
||||
#' @importFrom lubridate dmy_hms as_date interval %within%
|
||||
#' @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"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue