Skip to content

Commit

Permalink
make README.md examples working (#47)
Browse files Browse the repository at this point in the history
Also export Name.
  • Loading branch information
bkamins committed May 6, 2020
1 parent d40d0ca commit bea66d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions README.md
Expand Up @@ -6,7 +6,7 @@

This package allows computing one- or multi-way frequency tables (a.k.a. contingency or pivot tables) from
any type of vector or array. It includes support for [`CategoricalArray`](https://github.com/JuliaData/CategoricalArrays.jl)
and [`DataFrame`](https://github.com/JuliaData/DataFrames.jl), as well as for weighted counts.
and [`Tables.jl`](https://github.com/JuliaData/Tables.jl) compliant objects, as well as for weighted counts.

Tables are represented as [`NamedArray`](https://github.com/davidavdav/NamedArrays.jl/) objects.

Expand Down Expand Up @@ -53,7 +53,7 @@ b │ 3 2
c │ 2 3
d │ 2 3

julia> prop(tbl2, 2)
julia> prop(tbl2, margins=2)
4×2 Named Array{Float64,2}
Dim1 ╲ Dim2 │ A B
────────────┼─────────
Expand All @@ -72,13 +72,13 @@ c │ 2.0 3.0
d │ 1.0 1.5
```

For convenience, when working with a data frame, one can also pass a `DataFrame` object and columns as symbols:
For convenience, when working with tables (like e.g. a `DataFrame`) one can pass a table object and columns as symbols:
```julia
julia> using DataFrames, CSV

julia> iris = CSV.read(joinpath(Pkg.dir("DataFrames"), "test/data/iris.csv"));
julia> iris = DataFrame(CSV.File(joinpath(dirname(pathof(DataFrames)), "../docs/src/assets/iris.csv")));

julia> iris[:LongSepal] = iris[:SepalLength] .> 5.0;
julia> iris.LongSepal = iris.SepalLength .> 5.0;

julia> freqtable(iris, :Species, :LongSepal)
3×2 Named Array{Int64,2}
Expand All @@ -88,7 +88,7 @@ setosa │ 28 22
versicolor │ 3 47
virginica │ 1 49

julia> freqtable(iris, :Species, :LongSepal, subset=iris[:PetalLength] .< 4.0)
julia> freqtable(iris, :Species, :LongSepal, subset=iris.PetalLength .< 4.0)
2×2 Named Array{Int64,2}
Species ╲ LongSepal │ false true
────────────────────┼─────────────
Expand Down
2 changes: 1 addition & 1 deletion src/FreqTables.jl
Expand Up @@ -6,5 +6,5 @@ module FreqTables

include("freqtable.jl")

export freqtable, proptable, prop
export freqtable, proptable, prop, Name
end # module

2 comments on commit bea66d0

@nalimilan
Copy link
Owner

Choose a reason for hiding this comment

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

@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/14297

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.3.3 -m "<description of version>" bea66d0524260876af2488e5e8571f5a80366c4e
git push origin v0.3.3

Please sign in to comment.