Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
PharmCat committed Jul 21, 2021
1 parent a3c2c16 commit 98efc19
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
struct MetidaTable{T <: NamedTuple}
table::T
end

function metida_table(table::NamedTuple)
MetidaTable(table)
end
function metida_table(args...; names = nothing)
if length(args) > 1
e1 = length(args[1])
Expand Down Expand Up @@ -165,19 +167,19 @@ getid_safe(idd::AbstractIdData, ind) = getindormiss(idd.id, ind)

getid_unsafe(idd::AbstractIdData, ind) = idd.id[ind]

getid_safe(asr::AbstractSubjectResult, ind) = getindormiss(asr.data.id, ind)
getid_safe(asr::AbstractIDResult, ind) = getindormiss(asr.data.id, ind)

getid_unsafe(asr::AbstractSubjectResult, ind) = asr.data.id[ind]
getid_unsafe(asr::AbstractIDResult, ind) = asr.data.id[ind]

getid(idd::AbstractIdData, ind) = getid_safe(idd, ind)

getid(asr::AbstractSubjectResult, ind) = getid_safe(asr, ind)
getid(asr::AbstractIDResult, ind) = getid_safe(asr, ind)

getid(idd::AbstractIdData) = idd.id

getid(asr::AbstractSubjectResult) = asr.data.id
getid(asr::AbstractIDResult) = asr.data.id

function getid(d::DataSet{T}, col::Int, ind) where T <: Union{AbstractIdData, AbstractSubjectResult}
function getid(d::DataSet{T}, col::Int, ind) where T <: Union{AbstractIdData, AbstractIDResult}
getid(d[col], ind)
end
function getid(d::DataSet{T}, col::Colon, ind) where T <: AbstractIdData
Expand All @@ -186,7 +188,7 @@ function getid(d::DataSet{T}, col::Colon, ind) where T <: AbstractIdData
end
getid_unsafe.(d.ds, ind)
end
function getid(d::DataSet{T}, col::Colon, ind) where T <: AbstractSubjectResult
function getid(d::DataSet{T}, col::Colon, ind) where T <: AbstractIDResult
@inbounds for i in Base.OneTo(length(d))
if Base.ht_keyindex(d.ds[i].data.id, ind) < 1 return getid_safe.(d.ds, ind) end
end
Expand Down

2 comments on commit 98efc19

@PharmCat
Copy link
Owner

Choose a reason for hiding this comment

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

@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/41439

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 v0.3.0 -m "<description of version>" 98efc19b05f5f5c6040321f549f109dd31987482
git push origin v0.3.0

Please sign in to comment.