Spatex.Explorer (Spatex v0.2.1)

Copy Markdown View Source

Per-site results as Explorer.DataFrames.

to_dataframe/2 turns a local ESDA result (Spatex.ESDA.MoranLocal, Spatex.ESDA.GLocal, and any other result struct whose per-site fields are lists with one entry per site), a Spatex.Classify result or a Spatex.Region result into a dataframe with one row per site. Explorer is an optional dependency: it is only touched when this module is called, through runtime dispatch, so Spatex compiles and runs without it.

Columns

Every field that is a list with one scalar per site becomes a column named after the field (is, q, z, lag, p_sim, gs, zs, ...). Fields that are nil (for example p_sim with permutations: 0), the simulation matrices (sim) and non-per-site fields are skipped. In addition:

Non-finite floats stay :nan, :infinity and :neg_infinity, which Explorer reads as float special values.

Options

  • :crit - significance level for the cluster column (default 0.05).

Examples

iex> g = Spatex.Graph.from_arrays([0, 1, 1, 2, 2, 3], [1, 0, 2, 1, 3, 2])
iex> m = Spatex.ESDA.moran_local([1, 5, 2, 8], g, permutations: 0)
iex> df = Spatex.Explorer.to_dataframe(m)
iex> Explorer.Series.to_list(df["q"])
[2, 4, 2, 4]

Summary

Functions

Converts a per-site result to an Explorer.DataFrame. See the module documentation.

Functions

to_dataframe(result, opts \\ [])

@spec to_dataframe(struct(), keyword()) :: struct()

Converts a per-site result to an Explorer.DataFrame. See the module documentation.