Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #32

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
5 changes: 3 additions & 2 deletions R/categories.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ srr_stats_categories <- function () {
#' @noRd
list_categories <- function () {

# u <- paste0 (base_url (), "git/trees/main?recursive=1")
u <- paste0 (base_url (raw = TRUE), "main/standards.Rmd")
# u <- paste0 (base_url (raw = TRUE), "main/standards.Rmd")
u <- paste0 (base_url (raw = TRUE), "dev/standards.Rmd")
tmp <- tempfile (fileext = ".Rmd")
ret <- utils::download.file (u, destfile = tmp, quiet = TRUE) # nolint

Expand Down Expand Up @@ -123,6 +123,7 @@ std_prefixes <- function () {
prefixes [cats == "time-series"] <- "TS"
prefixes [cats == "unsupervised"] <- "UL"
prefixes [cats == "distributions"] <- "PD"
prefixes [cats == "networks"] <- "NW"

return (data.frame (
category = cats,
Expand Down
13 changes: 12 additions & 1 deletion R/dl-standards.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ base_url <- function (raw = FALSE) {
#' @noRd
dl_standards <- function (category = "general", quiet = FALSE) {

branch <- ifelse (
category %in% c ("distributions", "networks"),
"dev",
"main"
)
u <- paste0 (
base_url (raw = TRUE),
"main/standards/", category, ".Rmd"
branch,
"/standards/", category, ".Rmd"
)

tmp <- file.path (
Expand Down Expand Up @@ -176,6 +182,11 @@ category_titles_urls <- function (category) {
title = "Probability Distributions",
url = paste0 (u_base, "standards-distributions")
)
} else if (category == "networks") {
ret <- list (
title = "Networks",
url = paste0 (u_base, "standards-networks")
)
}

return (ret)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-report.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test_that ("srr_report", {

categories <- srr_stats_categories ()$category
categories <- categories [-which (categories == "general")]
expect_length (categories, 8L)
expect_length (categories, 9L)

f <- file.path (path, "R", "srr-stats-standards.R")
expect_true (file.exists (f))
Expand Down