Skip to content

Commit

Permalink
add _countmissing
Browse files Browse the repository at this point in the history
Anticipate adding more functionality regarding counting missing values for version 0.3
  • Loading branch information
markgpritchard committed Mar 28, 2024
1 parent 8d7b10e commit ca6d62e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TableOne"
uuid = "d36ae967-72a8-4ff4-a661-f51e671fe83a"
authors = ["Mark Pritchard <[email protected]>"]
version = "0.2.0"
version = "0.2.1"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
11 changes: 8 additions & 3 deletions src/TableOne.jl
Original file line number Diff line number Diff line change
Expand Up @@ -581,14 +581,19 @@ function _getvarname(var, varnames::Dict)
end

function _addnmissing!(_t, varvect, strataids)
idmissing = findall(ismissing, varvect)
vectorcountmissing = findall(x -> x idmissing, strataids[:Total])
n = length(vectorcountmissing)
n = _countmissing(varvect)
nmissing = [ "" for _ axes(_t, 1) ]
nmissing[1] = sprint(show, n)
insertcols!(_t, :nmissing => nmissing)
end

function _countmissing(varvect, sn=:Total)
idmissing = findall(ismissing, varvect)
vectorcountmissing = findall(x -> x idmissing, strataids[Symbol(sn)])
n = length(vectorcountmissing)
return n
end

_binvariabledisplay(v, varvect, binvardisplay::Nothing) = maximum(skipmissing(unique(varvect)))

function _binvariabledisplay(v, varvect, binvardisplay::Dict)
Expand Down

0 comments on commit ca6d62e

Please sign in to comment.