Skip to content

Commit

Permalink
Update FixedEffect.jl (#49)
Browse files Browse the repository at this point in the history
* Update FixedEffect.jl

Handles the fact that `eachindex` does not necessarily returns integer (e.g. SentinelArrays)

* Update Project.toml
  • Loading branch information
matthieugomez authored Jul 2, 2021
1 parent dc47665 commit 0bad33f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "FixedEffects"
uuid = "c8885935-8500-56a7-9867-7708b20db0eb"
version = "2.0.5"
version = "2.0.6"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
10 changes: 5 additions & 5 deletions src/FixedEffect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ function _group(xs, ::Nothing)
refs = Array{UInt32}(undef, size(xs))
invpool = Dict{eltype(xs), UInt32}()
n = UInt32(0)
z = UInt32(0)
@inbounds for i in eachindex(xs)
x = xs[i]
i = UInt32(0)
@inbounds for x in xs
i += 1
if x === missing
refs[i] = 0
else
lbl = get(invpool, x, z)
lbl = get(invpool, x, UInt32(0))
if !iszero(lbl)
refs[i] = lbl
else
Expand Down Expand Up @@ -248,4 +248,4 @@ end

function full(fecoefs::AbstractVector{<: Vector{<: Real}}, fes::AbstractVector{<:FixedEffect})
[fecoef[fe.refs] for (fecoef, fe) in zip(fecoefs, fes)]
end
end

2 comments on commit 0bad33f

@matthieugomez
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/40135

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.0.6 -m "<description of version>" 0bad33ff9ab4e360d8a2f2c06eb370a1212d96b8
git push origin v2.0.6

Please sign in to comment.