Skip to content

Commit

Permalink
Adapt reading modules and examples for BDS 71 to string of four numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
stefvanbuuren committed Mar 21, 2024
1 parent 72f0602 commit 38cff61
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
12 changes: 5 additions & 7 deletions R/convert_checked_list_3.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,15 @@ convert_checked_list_3 <- function(bds, ds) {
first()
}

if (all(hasName(bds, c("number", "nest", "code")))) {
if (all(hasName(bds, c("character", "nest", "code")))) {
psn[["blbf"]] <-
filter(bds, bds == 71L & .data$nest == 62L & .data$code == "01") %>%
pull("number") %>%
first() %>%
as.integer()
pull("character") %>%
first()
psn[["blbm"]] <-
filter(bds, bds == 71L & .data$nest == 62L & .data$code == "02") %>%
pull("number") %>%
first() %>%
as.integer()
pull("character") %>%
first()
}

if (all(hasName(bds, c("category", "nest", "code")))) {
Expand Down
4 changes: 2 additions & 2 deletions R/convert_raw_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ set_type <- function(bds) {
948, 949, 950, 953, 954, 972, 980, 982, 984,
998, 1001, 1278)
date <- c(20, 63)
number <- c(71, 82, 110, 235, 238, 240, 245, 252, 471)
character <- c(16)
number <- c(82, 110, 235, 238, 240, 245, 252, 471)
character <- c(16, 71)

type <- rep(NA_character_, length(bds))
type[bds %in% category] <- "category"
Expand Down
2 changes: 1 addition & 1 deletion data-raw/R/bds_lexicon.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ create_bds_lexicon <- function() {
"one of: 01, 02, 03, 04, 05, 06, 07, 08, 98",
"yyyymmdd",
"one of: 01, 02, 03, 04, 05, 06, 07, 08, 98, 00",
"4-digit code",
"string with 4-digits",
"in days",
"one of: 1, 2, 99",
"in grammes",
Expand Down
4 changes: 2 additions & 2 deletions inst/examples/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
},
{
"bdsNumber": 71,
"value": 6030
"value": "6030"
}
]
},
Expand All @@ -110,7 +110,7 @@
},
{
"bdsNumber": 71,
"value": 6030
"value": "6030"
},
{
"bdsNumber": 66,
Expand Down

0 comments on commit 38cff61

Please sign in to comment.