Most variable codebook entries have four fields before the code translation table, but some have five (and some may have even more, we will need to check). These seem to trip up the DB code:
> nhanesOptions(use.db = FALSE)
> nhanesCodebook("WHQ_J")$WHD010 |> str()
List of 6
$ Variable Name: : chr "WHD010"
$ SAS Label: : chr "Current self-reported height (inches)"
$ English Text: : chr "These next questions ask about {your/SP's} height and weight at different times in {your/his/her} life. How tal"| __truncated__
$ English Instructions:: chr "ENTER HEIGHT IN FEET AND INCHES OR METERS AND CENTIMETERS."
$ Target: : chr "Both males and females 16 YEARS -\r 150 YEARS"
$ WHD010 : tibble [4 × 5] (S3: tbl_df/tbl/data.frame)
..$ Code or Value : chr [1:4] "49 to 82" "7777" "9999" "."
..$ Value Description: chr [1:4] "Range of Values" "Refused" "Don't know" "Missing"
..$ Count : int [1:4] 5977 1 128 55
..$ Cumulative : int [1:4] 5977 5978 6106 6161
..$ Skip to Item : logi [1:4] NA NA NA NA
The DB version puts the English Instructions in the UseConstraints column.
> phonto::metaData("V") |> subset(TableName == "WHQ_J" & Variable == "WHD010") |> str()
'data.frame': 1 obs. of 11 variables:
$ Variable : chr "WHD010"
$ TableName : chr "WHQ_J"
$ Description : chr "These next questions ask about {your/SP's} height and weight at different times in {your/his/her} life. How tal"| __truncated__
$ Target : chr "Both males and females 16 YEARS - 150 YEARS"
$ SasLabel : chr "Current self-reported height (inches)"
$ UseConstraints: chr "ENTER HEIGHT IN FEET AND INCHES OR METERS AND CENTIMETERS."
$ ProcessedText : chr "Current self-reported height (inches)"
$ Tags : chr NA
$ VariableID : chr NA
$ IsPhenotype : chr "TRUE"
$ OntologyMapped: chr "FALSE"
Most variable codebook entries have four fields before the code translation table, but some have five (and some may have even more, we will need to check). These seem to trip up the DB code:
The DB version puts the
English Instructions
in theUseConstraints
column.