Skip to content

Commit

Permalink
Merge pull request #14 from markgpritchard/0_2_1
Browse files Browse the repository at this point in the history
0 2 1
  • Loading branch information
markgpritchard committed Mar 28, 2024
2 parents 75a08be + c19a6f6 commit 9b18370
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 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 <mark.pritchard@ndm.ox.ac.uk>"]
version = "0.2.0"
version = "0.2.1"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This package is designed to summarize a dataset, for example information about p
tableone
```

## Detailed examples of useage
## Detailed examples of usage

### Mock dataset for examples

Expand Down
14 changes: 9 additions & 5 deletions src/TableOne.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Each of these must be supplied as the same type as `vars`, e.g. if `vars` is a `
a separate line with the **number (%)** in that category
* `npvars`: non-parametric variables – will display **median [1st–3rd quartiles]**
* `paramvars`: parametric variables – will display **mean (standard deviation)**
* `cramvars`: a variation on `binvars` that displays both levels in one row on the table
* `cramvars`: a variation of `binvars` that displays both levels in one row on the table
Any variables not included in one of these arguments will be presented as
`mean (standard deviation)` if the contents of the variable are
Expand All @@ -60,7 +60,6 @@ Any variables not included in one of these arguments will be presented as
Any variables not included will be listed by the column name
See documentation for examples.
```
"""
function tableone(data, strata, vars::Vector; kwargs...)
stratanames = collect(skipmissing(unique(getproperty(data, strata))))
Expand Down Expand Up @@ -582,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, strataids)
nmissing = [ "" for _ axes(_t, 1) ]
nmissing[1] = sprint(show, n)
insertcols!(_t, :nmissing => nmissing)
end

function _countmissing(varvect, strataids, 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

2 comments on commit 9b18370

@markgpritchard
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:
Updated documentation, help text, readme

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/103783

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.1 -m "<description of version>" 9b183700aa765d9c2a5899fd240c10c87cd187d1
git push origin v0.2.1

Please sign in to comment.