Closed kescobo closed 2 years ago
Thanks for that. I've patched it up here #5 but to be honest, I need to sit down and have a proper think about the different data types people will be using etc.
julia> x = rand(100);
julia> xm = Union{Missing, Float64}[x...];
julia> df = DataFrame(x = x, xm = xm);
julia> y = rand(100, 5);
julia> permanova(df, y, BrayCurtis, @formula(1~x))
| Df | SumOfSqs | R² | F | P
-------------------------------------------------
x | 1 | 0.091 | 0.013 | 1.273 | 0.313
Residual | 98 | 7.028 | 0.987 | |
Total | 99 | 7.119 | 1 | |
julia> permanova(df, y, BrayCurtis, @formula(1~xm))
| Df | SumOfSqs | R² | F | P
-------------------------------------------------
xm | 1 | 0.091 | 0.013 | 1.273 | 0.282
Residual | 98 | 7.028 | 0.987 | |
Total | 99 | 7.119 | 1 | |
julia> df.xm[2] = missing
missing
julia> permanova(df, y, BrayCurtis, @formula(1~xm))
┌ Warning: 1 data row(s) dropped due to missing values.
└ @ PERMANOVA C:\Users\arn203\.julia\dev\PerMANOVA\src\perm2.jl:90
| Df | SumOfSqs | R² | F | P
-------------------------------------------------
xm | 1 | 0.092 | 0.013 | 1.275 | 0.300
Residual | 97 | 7.000 | 0.987 | |
Total | 98 | 7.092 | 1 | |
Nice! Also nice to handle the case where there are actual missings, I've been filtering those manually
In the following example,
x
andxm
are identical, except thatx
isVector{Float64}
andxm
isVector{Union{Missing, Float64}}
. I remember Makie used to have a similar problem, where the union eltype wouldn't get plotted as continuous.