Skip to content

Commit

Permalink
Add tibblify()
Browse files Browse the repository at this point in the history
  • Loading branch information
asadow committed Mar 21, 2024
1 parent 2f37404 commit d038a08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Imports:
rlang,
stringi,
tibble,
tibblify,
tidyr
URL: https://github.com/asadow/megamation, https://asadow.github.io/megamation/
BugReports: https://github.com/asadow/megamation/issues
Expand Down
9 changes: 8 additions & 1 deletion R/utils-parse.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extract_criteria_or_labels <- function(parsed) {
description <- field <- NULL

parsed <- parsed |> purrr::discard_at(c("Table", "Criteria", "Usage"))

## No use for tibblify() here. parsed is a simple list.
data.frame(
field = names(parsed) |> tolower(),
description = unlist(parsed)
Expand All @@ -78,6 +78,13 @@ extract_schema <- function(parsed) {
type <- description <- field <- NULL

p <- parsed$properties

## Can use tibblify() instead
# p |>
# tibblify::tibblify() |>
# dplyr::rename(field = .names) |>
# as.data.frame()

tibble::tibble(
field = names(p) |> tolower(),
description = purrr::map_chr(p, "description"),
Expand Down

0 comments on commit d038a08

Please sign in to comment.