diff --git a/Project.toml b/Project.toml index 3c42253..7b073d8 100644 --- a/Project.toml +++ b/Project.toml @@ -15,7 +15,7 @@ StatsModels = "3eaba693-59b7-5ba5-a881-562e759f1c8d" [compat] Compat = "^3.0" -DataFrames = "0.19, 0.20, 0.21" +DataFrames = "0.21, 0.22" DataStructures = "0.17, 0.18" Distributions = "0.20, 0.21, 0.22, 0.23, 0.24" Formatting = "^0.3.3, 0.4" diff --git a/src/QuickTools.jl b/src/QuickTools.jl index 91fe677..abe19d8 100644 --- a/src/QuickTools.jl +++ b/src/QuickTools.jl @@ -93,7 +93,7 @@ end function tabulate(df::AbstractDataFrame, field::Symbol) # Count the number of observations by `field` - tab = by(df, field, _N = field => length) + tab = combine(groupby(df, field), field => length => :_N) # Construct a Frequency Column sort!(tab, field) @@ -116,7 +116,7 @@ function tabulate(df::AbstractDataFrame, field1::Symbol, field2::Symbol) # Count the number of observations by `field` fields = vcat(field1, field2) df = dropmissing(df[!,fields], disallowmissing=true) - tab = by(df, fields, _N = field1 => length) + tab = combine(groupby(df, fields), field1 => length => :_N) sort!(tab, [field1, field2]) # Put it into wide form