Skip to content

Commit b015fe5

Browse files
author
PharmCat
committed
v0.6.4 types fix
1 parent ebedf6f commit b015fe5

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ClinicalTrialUtilities"
22
uuid = "535c2557-d7d0-564d-8ff9-4ae146c18cfe"
33
authors = ["Vladimir Arnautov (mail@pharmcat.net)"]
4-
version = "0.6.3"
4+
version = "0.6.4"
55

66
[deps]
77
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"

src/ci.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
# metafor by Wolfgang Viechtbauer https://cran.r-project.org/package=metafor
1111

1212
struct ConfInt
13-
lower::Real
14-
upper::Real
15-
estimate::Real
16-
alpha::Real
13+
lower::Float64
14+
upper::Float64
15+
estimate::Float64
16+
alpha::Float64
1717
#method::Symbol
1818
function ConfInt(lower, upper, estimate)
1919
new(lower, upper, estimate, NaN)::ConfInt

src/dataset.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ function Base.getindex(a::DataSet{T}, d::Tuple{Vararg{Pair}})::T where T
3737
return a[Dict(d)]
3838
end
3939

40-
4140
function Base.getindex(a::DataSet{T}, i::Int, s::Symbol)::Real where T
4241
return a.data[i].result[s]
4342
end

src/descriptives.jl

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function Base.show(io::IO, obj::Descriptive)
3030
end
3131

3232

33-
function Base.getindex(a::Descriptive, s::Symbol)::Real
33+
function Base.getindex(a::Descriptive, s::Symbol)
3434
return a.result[s]
3535
end
3636

@@ -117,7 +117,7 @@ end
117117
descriptive(data;
118118
sort::Union{Symbol, Array{T,1}} = Array{Symbol,1}(undef,0),
119119
vars = [],
120-
stats::Union{Symbol, Array{T,1}, Tuple{Vararg{Symbol}}} = :default)::DataSet{Descriptive} where T <: Union{Symbol, String}
120+
stats = :default)::DataSet{Descriptive} where T <: Union{Symbol, String}
121121
122122
Descriptive statistics.
123123
@@ -126,9 +126,9 @@ Descriptive statistics.
126126
- ``stats`` statistics
127127
"""
128128
function descriptive(data;
129-
sort::Union{Symbol, Array{T,1}} = Array{Symbol,1}(undef,0),
129+
sort::Union{Symbol, Vector{T}} = Vector{Symbol}(undef,0),
130130
vars = [],
131-
stats::Union{Symbol, Array{T,1}, Tuple{Vararg{Symbol}}} = :default, level = 0.95)::DataSet{Descriptive} where T <: Union{Symbol, String}
131+
stats = :default, level = 0.95)::DataSet{Descriptive} where T <: Union{Symbol, String}
132132

133133
stats = checkstats(stats)
134134
if isa(vars, UnitRange{Int64})
@@ -181,16 +181,15 @@ function descriptive(data;
181181
end
182182
return DataSet(d)
183183
end
184-
function descriptive(data::Array{T, 1}; stats::Union{Symbol, Vector, Tuple} = :default, var = nothing, varname = nothing, sort = Dict(), level = 0.95)::Descriptive where T <: Real
184+
function descriptive(data::Vector{T}; stats = :default, var = nothing, varname = nothing, sort = Dict(), level = 0.95) where T <: Real
185185
stats = checkstats(stats)
186186
return Descriptive(var, varname, sort, descriptive_(data, stats, level))
187-
188187
end
189188

190189
"""
191190
Check if all statistics in allstat list. return stats tuple
192191
"""
193-
@inline function checkstats(stats::Union{Symbol, Array{T,1}, Tuple{Vararg{Symbol}}})::Tuple{Vararg{Symbol}} where T <: Union{Symbol, String}
192+
@inline function checkstats(stats)
194193
allstat = (:n, :min, :max, :range, :mean, :var, :sd, :sem, :cv, :harmmean, :geomean, :geovar, :geosd, :geocv, :skew, :ses, :kurt, :sek, :uq, :median, :lq, :iqr, :mode, :meanci)
195194
if isa(stats, Symbol)
196195
if stats == :default stats = (:n, :mean, :sd, :sem, :uq, :median, :lq)
@@ -206,15 +205,15 @@ end
206205
"""
207206
Push in d Descriptive obj in mx vardata
208207
"""
209-
@inline function pushvardescriptive!(d::Array{Descriptive, 1}, vars::Array{Symbol, 1}, mx, sortval::Union{Tuple{Vararg{Any}}, Nothing}, stats::Tuple{Vararg{Symbol}}) where T<: Real
208+
@inline function pushvardescriptive!(d::Vector{Descriptive}, vars::Vector{Symbol}, mx, sortval, stats)
210209
for v = 1:length(vars) #For each variable in list
211210
push!(d, Descriptive(vars[v], nothing, sortval, descriptive_(mx[:, v], stats)))
212211
end
213212
end
214213
"""
215214
Check if data row sortcol equal sortval
216215
"""
217-
@inline function checksort(data, row::Int, sortcol::Array{Symbol, 1}, sortval::Tuple{Vararg{Any}})::Bool
216+
@inline function checksort(data, row::Int, sortcol::Vector{Symbol}, sortval)
218217
for i = 1:length(sortcol)
219218
if data[row, sortcol[i]] != sortval[i] return false end
220219
end
@@ -223,7 +222,7 @@ end
223222
"""
224223
Return matrix of filtered data (datacol) by sortcol with sortval
225224
"""
226-
@inline function getsortedmatrix(data; datacol::Array{Symbol,1}, sortcol::Array{Symbol,1}, sortval::Tuple{Vararg{Any}})
225+
@inline function getsortedmatrix(data; datacol::Vector{Symbol}, sortcol::Vector{Symbol}, sortval)
227226
result = Array{promote_type(eltype.(data[!, c] for c in datacol)...), 1}(undef, 0)
228227
for c = 1:size(data, 1) #For each line in data
229228
if checksort(data, c, sortcol, sortval)
@@ -241,7 +240,7 @@ function notnan(x)
241240
return !(x === NaN || x === nothing || x === missing)
242241
end
243242

244-
@inline function descriptive_(data::Vector{T}, stats::Union{Tuple{Vararg{Symbol}}, Array{Symbol,1}}, level) where T
243+
@inline function descriptive_(data::Vector{T}, stats, level) where T
245244

246245
#=
247246
dlist = findall(x -> x === NaN || x === nothing || x === missing, data)
@@ -275,7 +274,7 @@ end
275274

276275

277276

278-
dict = Dict{Symbol, Real}()
277+
dict = Dict{Symbol, Float64}()
279278

280279

281280
if length(data) == 0
@@ -419,10 +418,10 @@ end
419418
return sqrt(6 * n *(n - 1) / ((n - 2) * (n + 1) * (n + 3)))
420419
end
421420

422-
@inline function sek(data::AbstractVector; ses::T = ses(data)) where T <: Real
421+
@inline function sek(data::AbstractVector; ses = ses(data))
423422
n = length(data)
424423
sek(n; ses = ses)
425424
end
426-
@inline function sek(n::Int; ses::T = ses(n)) where T <: Real
425+
@inline function sek(n::Int; ses = ses(n))
427426
return 2 * ses * sqrt((n * n - 1)/((n - 3) * (n + 5)))
428427
end

0 commit comments

Comments
 (0)