Liking cljdoc? Tell your friends :D
Clojure only.

datajure.reshape

Reshape functions for datajure. Currently provides wide->long (melt).

Reshape functions for datajure. Currently provides wide->long (melt).
raw docstring

meltclj

(melt dataset
      {:keys [id measure variable-col value-col]
       :or {variable-col :variable value-col :value}})

Reshape a dataset from wide to long format.

Arguments: dataset - a tech.v3.dataset opts - map with keys: :id - (required) vector of column keywords to keep as identifiers :measure - vector of column keywords to stack. Defaults to all non-id columns. :variable-col - keyword for the new variable column. Defaults to :variable. :value-col - keyword for the new value column. Defaults to :value.

Returns a dataset with one row per (id, measure) combination.

Examples: ;; Basic melt (melt ds {:id [:species :year] :measure [:mass :flipper :bill]})

;; Infer measure cols (all non-id) (melt ds {:id [:species :year]})

;; Custom output column names (melt ds {:id [:species :year] :measure [:mass :flipper] :variable-col :metric :value-col :val})

Reshape a dataset from wide to long format.

Arguments:
  dataset  - a tech.v3.dataset
  opts     - map with keys:
    :id           - (required) vector of column keywords to keep as identifiers
    :measure      - vector of column keywords to stack. Defaults to all non-id columns.
    :variable-col - keyword for the new variable column. Defaults to :variable.
    :value-col    - keyword for the new value column. Defaults to :value.

Returns a dataset with one row per (id, measure) combination.

Examples:
  ;; Basic melt
  (melt ds {:id [:species :year] :measure [:mass :flipper :bill]})

  ;; Infer measure cols (all non-id)
  (melt ds {:id [:species :year]})

  ;; Custom output column names
  (melt ds {:id [:species :year] :measure [:mass :flipper]
            :variable-col :metric :value-col :val})
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close