Skip to content

Commit 1dc183d

Browse files
Merge pull request #280 from ClojureCivitas/column-combos
update definition of numeric
2 parents c415a50 + 084bd4e commit 1dc183d

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/data_visualization/aog/column_combinations.clj

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ penguins
6161
;; Type detection: determines whether to show histograms (numeric) or bar charts (categorical)
6262

6363
(defn is-numeric-type? [col]
64-
(let [col-type (tcc/typeof col)]
65-
(or (= col-type :float32)
66-
(= col-type :float64)
67-
(= col-type :int32)
68-
(= col-type :int64))))
64+
(tcc/typeof? col :numerical))
6965

7066
(defn plot-basic [g]
7167
(let [{:keys [data mappings geometry]} (g 1)
@@ -145,14 +141,14 @@ penguins
145141
(defn get-summary-stats [ds column]
146142
(let [col (ds column)]
147143
(if (is-numeric-type? col)
148-
(let [stats (fms/stats-map (remove nil? col))]
144+
(let [stats (tcc/descriptive-statistics col)]
149145
(format "n: %d, μ: %.2f, σ: %.2f, min: %.2f, max: %.2f"
150-
(:Size stats)
151-
(:Mean stats)
152-
(:SD stats)
153-
(:Min stats)
154-
(:Max stats)))
155-
(let [values (remove nil? col)
146+
(:n-elems stats)
147+
(:mean stats)
148+
(:standard-deviation stats)
149+
(:min stats)
150+
(:max stats)))
151+
(let [values (tcc/drop-missing col)
156152
counts (frequencies values)]
157153
(str "n: " (count values) ", unique: " (count counts))))))
158154

0 commit comments

Comments
 (0)