Hello everyone,
I’m struggling at the moment with boxplots. My data has several data points and many of them is NaN or Inf or missing. I was wondering if there is a way to just ignore these values without trying to edit data itself?
A simple example can be like this:
boxplot([1, 2, 3, NaN, 20, 1, 2, 7, 3])
Error:
ERROR: ArgumentError: quantiles are undefined in presence of NaNs or missing values
Stacktrace:
[1] _quantilesort!(v::Vector{Float64}, sorted::Bool, minp::Float64, maxp::Float64)
@ Statistics ~/.julia/juliaup/julia-1.10.1+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Statistics/src/Statistics.jl:994
[2] #quantile!#49
@ ~/.julia/juliaup/julia-1.10.1+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Statistics/src/Statistics.jl:964 [inlined]
[3] quantile!
@ ~/.julia/juliaup/julia-1.10.1+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Statistics/src/Statistics.jl:960 [inlined]
[4] quantile(v::Vector{…}, p::StepRangeLen{…}; sorted::Bool, alpha::Float64, beta::Float64)
@ Statistics ~/.julia/juliaup/julia-1.10.1+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Statistics/src/Statistics.jl:1089
[5] macro expansion
@ ~/.julia/packages/StatsPlots/cStOe/src/boxplot.jl:41 [inlined]
[6] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, ::Type{Val{:boxplot}}, x::Any, y::Any, z::Any)
@ StatsPlots ~/.julia/packages/RecipesBase/BRe07/src/RecipesBase.jl:300
[7] _process_seriesrecipe(plt::Any, plotattributes::Any)
@ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/series_recipe.jl:50
[8] _process_seriesrecipes!(plt::Any, kw_list::Any)
@ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/series_recipe.jl:27
[9] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
@ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/RecipesPipeline.jl:99
[10] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
@ Plots ~/.julia/packages/Plots/a3u1v/src/plot.jl:223
[11] plot(args::Any; kw...)
@ Plots ~/.julia/packages/Plots/a3u1v/src/plot.jl:102
[12] boxplot(args::Any; kw...)
@ Plots ~/.julia/packages/RecipesBase/BRe07/src/RecipesBase.jl:427
[13] top-level scope
@ Untitled-1:282
Some type information was truncated. Use `show(err)` to see complete types.