Skip to content

Commit

Permalink
missings for non-contiguous tables
Browse files Browse the repository at this point in the history
  • Loading branch information
alecloudenback committed Oct 20, 2021
1 parent 155ebf9 commit c577004
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/XTbML.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ parse a 1D table
"""
function parse_1D_table(tbl,index_adj=0)
first_index = Parsers.parse(Int,first(tbl)[:t])

vals = [get_and_parse(ai,"") for ai in tbl]
last_index = Parsers.parse(Int,last(tbl)[:t])

# some tables (e.g. 2975) don't have contiguous indices, so create interim dict to make
# dynamically creating an array with potentially missing values easy
d = Dict(Parsers.parse(Int,x[:t]) => get_and_parse(x,"") for x in tbl)
vals = [get(d,i,missing) for i in first_index:last_index]

while ismissing(last(vals))
# drop trailing missings, but not leading (e.g. keep leading for table 1076)
Expand Down

0 comments on commit c577004

Please sign in to comment.