You can insert a new column into the first position with insertcols
.
insertcols!(B, 1, :a => A.IID)
You can also use a leftjoin
(or other join
types) if the orders don’t match exactly.
For the collapse
-ing operation
@chain df begin
groupby("Herd.when.genotyped")
combine(:x1 => mean)
end
To get the mean of all the columns, do
@chain df begin
groupby("Herd.when.genotyped")
combine(names(df, Between(:x1, :x5)) .=> mean)
end