`r params$set_title`"

library(flexdashboard)
## Get user data
pkgname <- params$pkgname
from_date <- params$from
to_date <- params$to
gh <- params$gh

library(cranlogs)
library(dplyr)
library(ggplot2)
library(purrr)
library(ggiraph)
do.call(library, args = list("package" = pkgname))

date_diff <- as.Date(to_date, "%Y-%m-%d") - as.Date(from_date, "%Y-%m-%d")

cran_df <-
  cranlogs::cran_downloads(
  packages = pkgname,
  from = from_date,
  to = to_date
  )

cran_summary <-
  cran_df %>%
  summarise(
    min_count = min(count, na.rm = TRUE),
    max_count = max(count, na.rm = TRUE),
    mean_count = mean(count, na.rm = TRUE),
    max_date = max(date, na.rm = TRUE)
  )

# custom environment for package
env_pkg <- loadNamespace(pkgname)

# get full list of function names
fnc_str <-
  Filter(
  f = function(x, p = env_pkg){
    (is.function(get(x, p))
     # Exclude Reference Class object generators for now
     & !methods::is(get(x, p), "refObjectGenerator")
    )
  }
  , x = names(env_pkg)
)

# package dependencies
pkg_deps <- recursive_dependencies(package = pkgname, db = NULL)

# github owner/repository
gh_owner <- gsub(pattern = "/.+", replacement = "", x = gh)
gh_repos <- gsub(pattern = ".+/", replacement = "", x = gh)

# Open pull requests

if(is.null(gh)){

  gh_opr <- "N/A"

} else {

  gh_pr_df <- get_gh_pr(
    owner = gh_owner,
    repo = gh_repos
    )

  gh_opr <- gh_pr_df %>%
    filter(state == "open") %>%
    nrow()
}


# Open issues

if(is.null(gh)){

  gh_ois <- "N/A"

} else {

  gh_iss_df <- get_gh_issues(
    owner = gh_owner,
    repo = gh_repos
    ) 

  gh_ois <- gh_iss_df %>%
    filter(state == "open") %>%
    nrow()
}








Try the devtoolbox package in your browser

Any scripts or data that you put into this service are public.

devtoolbox documentation built on July 8, 2022, 5:08 p.m.