diff --git a/Project.toml b/Project.toml index 2f306fa..386377f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "TableOne" uuid = "d36ae967-72a8-4ff4-a661-f51e671fe83a" authors = ["Mark Pritchard "] -version = "0.2.0" +version = "0.2.1" [deps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" diff --git a/src/TableOne.jl b/src/TableOne.jl index c61d616..89abbc4 100644 --- a/src/TableOne.jl +++ b/src/TableOne.jl @@ -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)