create_1D_mapper_object: Run 1D mapper

View source: R/baskin_robbins.R

create_1D_mapper_objectR Documentation

Run 1D mapper

Description

Run mapper using a one-dimensional filter, a cover of intervals, and a clustering algorithm.

Usage

create_1D_mapper_object(
  data,
  dists,
  filtered_data,
  cover,
  clusterer = hierarchical_clusterer("single")
)

Arguments

data

A data frame.

dists

A distance matrix for the data frame.

filtered_data

The result of a function applied to the data frame; there should be one filter value per observation in the original data frame.

cover

A 2D array of interval left and right endpoints; rows should be intervals and columns left and right endpoints (in that order).

clusterer

A function which accepts a list of distance matrices as input, and returns the results of clustering done on each distance matrix.

Value

A list of two data frames, one with node data containing bin membership, data points per cluster, and cluster dispersion, and one with edge data containing sources, targets, and weights representing overlap strength.

Examples

data = data.frame(x = sapply(1:100, function(x) cos(x)), y = sapply(1:100, function(x) sin(x)))
projx = data$x

num_bins = 10
percent_overlap = 25

cover = create_width_balanced_cover(min(projx), max(projx), num_bins, percent_overlap)

create_1D_mapper_object(data, dist(data), projx, cover)

mappeR documentation built on April 3, 2025, 6:19 p.m.