You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/GroupedArrays.jl
+14-5
Original file line number
Diff line number
Diff line change
@@ -37,15 +37,21 @@ Base.@propagate_inbounds function Base.setindex!(g::GroupedArray{T}, x::Missing,
37
37
@boundscheckcheckbounds(g, i)
38
38
@inbounds g.refs[i] =0
39
39
end
40
+
"""
41
+
Constructor for GroupedArrays
40
42
41
-
# Constructor
42
-
functionGroupedArray(args...; coalesce =false)
43
+
GroupedArray constructor always promises that all elements between 1 and ngroups (included) are presented in refs. However, this is not necessarly true aftewards (setindex! does not check that the replaced ref corresponds to the last one)
44
+
45
+
if coalesce = true, missing values are associated an integer
46
+
if sort = false, groups are created in order of appearances. If sort = true, groups are sorted. If sort = nothing, fastest algorithm is used.
if!coalesce &any((eltype(x) >:Missingfor x in args))
50
56
T = Union{Int, Missing}
51
57
else
@@ -78,8 +84,11 @@ end
78
84
Base.allunique(x::GroupedRefPool) =true
79
85
80
86
DataAPI.refpool(g::GroupedArray{T}) where {T} =GroupedRefPool{T}(g.ngroups)
81
-
# invrefpool is such that invrefpool[refpool[x]] = x. Basically, it gives the index in the pool (so the ref level) corresponding to each element of refpool
82
-
# so it should be missing -> 0 and i -> i for 1 ≤ i ≤ g.ngroups
87
+
# invrefpool is such that invrefpool[refpool[x]] = x.
88
+
# In words, for each element of refpool, it associates the corresponding index in the pool
0 commit comments