Skip to contents

This function computes weights for hexagonal binning based on the average values of each bin and the distances from these averages.

Usage

compute_weights(nldr_df, hb_object)

Arguments

nldr_df

A data frame containing 2D embeddings without a unique identifier column (ID).

hb_object

A hexbin object containing the hexagonal binning information.

Value

A data frame with weights calculated for each hexagonal bin.

Examples

num_bins_x <- 4
shape_value <- 1.833091
hexbin_data_object <- extract_hexbin_centroids(nldr_df = s_curve_noise_umap,
num_bins = num_bins_x, shape_val = shape_value)
hexdf_data <- hexbin_data_object$hexdf_data
hb_obj <- hexbin_data_object$hb_data
compute_weights(nldr_df = s_curve_noise_umap |> dplyr::select(-ID), hb_object = hb_obj)
#> # A tibble: 75 × 6
#>    hb_id avg_umap1 avg_umap2 UMAP1 UMAP2 distance
#>    <int>     <dbl>     <dbl> <dbl> <dbl>    <dbl>
#>  1     1     -2.71     -5.38 -2.73 -5.35   0.0332
#>  2     1     -2.71     -5.38 -2.69 -5.40   0.0332
#>  3     2     -2.21     -5.52 -2.31 -5.50   0.107 
#>  4     2     -2.21     -5.52 -2.35 -5.68   0.209 
#>  5     2     -2.21     -5.52 -2.50 -5.74   0.367 
#>  6     2     -2.21     -5.52 -1.95 -5.34   0.321 
#>  7     2     -2.21     -5.52 -1.81 -5.32   0.442 
#>  8     2     -2.21     -5.52 -2.34 -5.54   0.130 
#>  9     6     -2.82     -4.20 -2.81 -3.91   0.293 
#> 10     6     -2.82     -4.20 -2.86 -4.28   0.0893
#> # ℹ 65 more rows