Skip to content

Commit

Permalink
Expose only cached table with english names
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksanderbl29 committed Nov 28, 2024
1 parent ebe14d4 commit 6b82260
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 59 deletions.
4 changes: 1 addition & 3 deletions R/dst_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ dst_search <- function(string = "gpd",

series <- httr::content(httr::GET(url = url))
series <- jsonlite::fromJSON(txt = series)
} else if (!is.null(use_cache) && lang == "da") {
series <- dkstat::tables_da
} else {
series <- dkstat::tables_en
series <- dkstat::tables
}

matches <- grep(string, series[, field], ignore.case = TRUE)
Expand Down
20 changes: 2 additions & 18 deletions R/dst_tables.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Cached list of all available tables
#'
#' @format ## `tables_en`
#' @format ## `tables`
#' A data frame with 2339 rows and 8 columns:
#' \describe{
#' \item{id}{Unique ID of the table}
Expand All @@ -12,20 +12,4 @@
#' \item{active}{Binary indicator of the table being active}
#' \item{variables}{List of the variables in the table}
#' }
"tables_en"

#' Cached list of all available tables with danish names and descriptions
#'
#' @format ## `tables_da`
#' A data frame with 2339 rows and 8 columns:
#' \describe{
#' \item{id}{Unique ID of the table}
#' \item{text}{Description of the table}
#' \item{unit}{The unit of the values represented in the table}
#' \item{updated}{When this table was last updated}
#' \item{firstPeriod}{The time of the first observation in the table}
#' \item{latestPeriod}{The time of the latest observation in the table}
#' \item{active}{Binary indicator of the table being active}
#' \item{variables}{List of the variables in the table}
#' }
"tables_da"
"tables"
10 changes: 5 additions & 5 deletions data-raw/dst_tables.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tables_en <- dst_get_tables(lang = "en")
tables <- dst_get_tables(lang = "en")

usethis::use_data(tables_en, overwrite = TRUE)
usethis::use_data(tables, overwrite = TRUE)

tables_da <- dst_get_tables(lang = "da")

usethis::use_data(tables_da, overwrite = TRUE)
# tables_da <- dst_get_tables(lang = "da")
#
# usethis::use_data(tables_da, overwrite = TRUE)
Binary file added data/tables.rda
Binary file not shown.
Binary file removed data/tables_da.rda
Binary file not shown.
Binary file removed data/tables_en.rda
Binary file not shown.
8 changes: 4 additions & 4 deletions man/tables_en.Rd → man/tables.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 0 additions & 29 deletions man/tables_da.Rd

This file was deleted.

0 comments on commit 6b82260

Please sign in to comment.