diff --git a/Project.toml b/Project.toml index 5345cb8..e4ebed6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MetidaBase" uuid = "075456b7-4006-432f-9324-2f8453996c49" authors = ["PharmCat and contributors"] -version = "0.1.2" +version = "0.2.0" [deps] StatsModels = "3eaba693-59b7-5ba5-a881-562e759f1c8d" diff --git a/src/types.jl b/src/types.jl index 8c0547d..008a671 100644 --- a/src/types.jl +++ b/src/types.jl @@ -33,7 +33,7 @@ end Base.first(ds::DataSet) = first(ds.data) function Base.getindex(ds::DataSet{T}, col::Colon, ind) where T <: AbstractResultData - v = Vector{Any}(undef, length(ds)) + v = Vector{Float64}(undef, length(ds)) @inbounds for i = 1:length(ds) v[i] = getindormiss(ds[i].result, ind) end @@ -44,6 +44,19 @@ function Base.getindex(ds::DataSet{T}, col::Int, ind) where T <: AbstractResultD getindormiss(ds[col].result, ind) end +function getid(ds::DataSet{T}, col::Colon, ind) where T <: AbstractIdData + v = Vector{Any}(undef, length(ds)) + @inbounds for i = 1:length(ds) + v[i] = getindormiss(ds[i].id, ind) + end + v +end + +function getid(ds::DataSet{T}, col::Int, ind) where T <: AbstractIdData + getindormiss(ds[col].id, ind) +end + + function Base.length(ds::DataSet) length(ds.data)