R's table function in Julia (for DataFrames)
You can use the countmap
function from StatsBase.jl
to count the entries of a single variable. General cross tabulation and statistical tests for contingency tables are lacking at this point. As Ismael points out, this has been discussed in the issue tracker for StatsBase.jl
.
I came to the conclusion that a similar effect can be achieved using by
:
Let jldata
consists of :gender
column.
julia> by(jldata, :gender, nrow)
3x2 DataFrames.DataFrame
| Row | gender | x1 |
|-----|----------|-------|
| 1 | NA | 175 |
| 2 | "female" | 40254 |
| 3 | "male" | 58574 |
Of course it's not a table
but at least I get the same data type as the datasource. Surprisingly by
seems to be faster than countmap
.