22
33nonunique (v) = [k for (k, v) in StatsBase. countmap (v) if v > 1 ]
44
5+ parse_gkw (s:: String ) = [Symbol (s)]
6+ parse_gkw (s:: Symbol ) = [s]
7+ parse_gkw (s:: AbstractVector{<:AbstractString} ) = Symbol .(s)
8+ parse_gkw (s:: AbstractVector{Symbol} ) = s
9+
10+ function floatparse (data:: Missing , warn)
11+ warn && @warn " Value $data parsed as `NaN`"
12+ return NaN
13+ end
14+
15+ function floatparse (data:: Nothing , warn)
16+ warn && @warn " Value $data parsed as `NaN`"
17+ return NaN
18+ end
19+
20+ floatparse (data:: AbstractFloat , :: Any ) = data
21+
22+ function floatparse (data:: AbstractString , warn)
23+ tp = tryparse (Float64, data)
24+ warn && isnothing (tp) && @warn " Value $data parsed as `NaN`"
25+ floatparse (tp, false )
26+ end
27+ function floatparse (data:: Int , warn)
28+ float (data)
29+ end
30+ #=
531function floatparse(data, warn)
632 if !isa(data, AbstractFloat) && !ismissing(data)
733 if isa(data, AbstractString)
@@ -25,7 +51,7 @@ function floatparse(data, warn)
2551 return data
2652 end
2753end
28-
54+ =#
2955
3056#=
3157function floatparse(data::AbstractVector)
@@ -107,8 +133,8 @@ keywords:
107133See also: [`ElimRange`](@ref), [`DoseTime`](@ref), [`LimitRule`](@ref).
108134"""
109135function pkimport (data, time, conc, sort; kelauto = true , elimrange = ElimRange (), dosetime = nothing , limitrule:: Union{Nothing, LimitRule} = nothing , warn = true , kwargs... )
110- if isa (sort, String) sort = [ Symbol (sort)] end
111- if isa ( sort, Symbol) sort = [ sort] end
136+
137+ sort = parse_gkw ( sort)
112138
113139 Tables. istable (data) || error (" Data not a table!" )
114140
@@ -216,8 +242,8 @@ Import urine PK data from table `data`.
216242* `sort` - subject sorting columns.
217243"""
218244function upkimport (data, stime, etime, conc, vol, sort; kelauto = true , elimrange = ElimRange (), dosetime = nothing )
219- if isa (sort, String) sort = [ Symbol (sort)] end
220- if isa ( sort, Symbol) sort = [ sort] end
245+
246+ sort = parse_gkw ( sort)
221247
222248 cols = Tables. columns (data)
223249 cdata = Tuple (Tables. getcolumn (cols, y) for y in sort)
@@ -328,8 +354,8 @@ Keywords:
328354
329355"""
330356function pdimport (data, time, obs, sort; bl = 0 , th = 0 , dosetime:: Union{Nothing, DoseTime} = nothing , limitrule:: Union{Nothing, LimitRule} = nothing , warn = true )
331- if isa (sort, String) sort = [ Symbol (sort)] end
332- if isa ( sort, Symbol) sort = [ sort] end
357+
358+ sort = parse_gkw ( sort)
333359
334360 Tables. istable (data) || error (" Data not a table!" )
335361
0 commit comments