Skip to contents

This function assigns the data to hexagons.

Usage

assign_data(data, centroid_df)

Arguments

data

data A tibble or data frame.

centroid_df

The dataset with centroid coordinates.

Value

A tibble contains embedding components and corresponding hexagon ID.

Examples

r2 <- diff(range(s_curve_noise_umap$UMAP2))/diff(range(s_curve_noise_umap$UMAP1))
all_centroids_df <- gen_centroids(bin1 = 4, r2 = r2, q = 0.1)
assign_data(data = s_curve_noise_umap_scaled, centroid_df = all_centroids_df)
#> # A tibble: 75 × 4
#>     UMAP1  UMAP2    ID hb_id
#>     <dbl>  <dbl> <int> <int>
#>  1 0.0804 0.320      1     5
#>  2 0.739  1.00       2    19
#>  3 0.840  1.08       3    19
#>  4 0.167  0.0432     4     5
#>  5 0.263  0.398      6    10
#>  6 0.838  2.01       7    31
#>  7 0.734  0.972      8    19
#>  8 0.627  0.721      9    14
#>  9 0.810  1.01      11    19
#> 10 0.903  1.87      12    28
#> # ℹ 65 more rows