Dataframe data manipulation

I have a data frame that is formatted like the example below.

 Row │ Pairwise                           p_adj        boo    Factor       IntBoo 
     │ String                             Float64      Bool   String       Int64
─────┼────────────────────────────────────────────────────────────────────────────
   1 │ Backwoods Blueberries Coville-12…  0.999599     false  Gall Weight       0
   2 │ Backwoods Blueberries Coville-12…  1.0          false  Gall Length       0
   3 │ Backwoods Blueberries Coville-12…  0.804792     false  Gall Width        0
   4 │ Backwoods Blueberries Coville-12…  2.63132e-8    true  BodySize          1
   5 │ Backwoods Blueberries Coville-12…  0.0822928    false  Egg Count         0
   6 │ Backwoods Blueberries Coville-12…  3.66398e-11   true  Egg Volume        1
   7 │ Backwoods Blueberries Coville-12…  0.993763     false  Sex Ratio         0
   8 │ Backwoods Blueberries Coville-12…  4.27341e-6    true  Parasitoid        1
   9 │ Backwoods Blueberries Jersey-128…  0.996053     false  Gall Weight       0
  10 │ Backwoods Blueberries Jersey-128…  0.583841     false  Gall Length       0

What I want is for Julia to count up the number of significant findings (boo=true), how many total pairwise comparisons and a list of the factors that were significant.

Example;

Pairwise                                    sig_fact  tot_fact     Factors that are significant
Backwoods Blueberries Coville-128th Northland     3     5     BodySize, Egg volume, Parasitoid

I have the first part done but am having a hard time getting the list of names for the significant factors. The intent is to export to an Excel spreadsheet then included in a Word Document

Mike Sergeant

combine(groupby(df, :Pairwise), [:Factor, :boo] => ((f, b) -> Ref(f[b])) => :Factors)
with MWE:

using DataFrames, Random;
pairWise = vcat(fill("p1", 5), fill("p2", 2));
boo = rand(Bool, 7);
factors = rand(["f1", "f2", "f3"], 7);
df = DataFrame(:Pairwise => pairWise, :boo => boo, :Factor => factors)

which gives

7×3 DataFrame
 Row │ Pairwise  boo    Factor 
     │ String    Bool   String 
─────┼─────────────────────────
   1 │ p1         true  f1
   2 │ p1        false  f2
   3 │ p1         true  f1
   4 │ p1        false  f3
   5 │ p1         true  f3
   6 │ p2         true  f3
   7 │ p2        false  f2
combine(groupby(df, :Pairwise), [:Factor, :boo] => ((f, b) -> Ref(f[b])) => :Factors)
2×2 DataFrame
 Row │ Pairwise  Factors            
     │ String    Array…             
─────┼──────────────────────────────
   1 │ p1        ["f1", "f1", "f3"]
   2 │ p2        ["f3"]

(I did not enforce that the factors are unique for each pairwise value).

With DataFramesMeta I think this is pretty elegant

julia> df_collaped = @chain df begin 
           @by :Pairwise begin 
               :num_factors = length(:boo)
               :num_sig_factors = sum(:boo)
               :sig_factors = Ref(:Factor[:boo])
           end
       end