From c92598d90de7d5a53f4ad496b3145984e14424ce Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2020 14:02:25 -0600 Subject: [PATCH] CompatHelper: bump compat for "DataFrames" to "0.22" (#24) * Add compat with DataFrames 0.22 * Drop compat with DataFrames 0.19 and 0.20 --- Project.toml | 2 +- src/QuickTools.jl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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