This function generates the hexagonal object.
Arguments
- data
A tibble that contains embedding components.
- bin1
Number of bins along the x axis.
- r2
The ratio of the ranges of the original embedding components.
- q
The buffer amount as proportion of data range.
Value
A object that contains numeric vector that contains bins along the x and y axes respectively (bins), numeric vector that contains hexagonal starting point coordinates all hexagonal bin centroids (centroids), hexagonal coordinates of the full grid(hex_poly), embedding components with their corresponding hexagon IDs (data_hb_id), hex bins with their corresponding standardise counts (std_cts), total number of hex bins(tot_bins), number of non-empty hex bins (non_bins) and points within each hexagon (pts_bins).
Examples
r2 <- diff(range(s_curve_noise_umap$UMAP2))/diff(range(s_curve_noise_umap$UMAP1))
num_bins_x <- 4
hex_binning(data = s_curve_noise_umap_scaled, bin1 = num_bins_x,
r2 = r2, q = 0.1)
#> $bins
#> [1] 4 8
#>
#> $start_point
#> [1] -0.1000000 -0.2019414
#>
#> $centroids
#> # A tibble: 32 × 3
#> hexID c_x c_y
#> <int> <dbl> <dbl>
#> 1 1 -0.1 -0.202
#> 2 2 0.283 -0.202
#> 3 3 0.666 -0.202
#> 4 4 1.05 -0.202
#> 5 5 0.0915 0.130
#> 6 6 0.474 0.130
#> 7 7 0.857 0.130
#> 8 8 1.24 0.130
#> 9 9 -0.1 0.461
#> 10 10 0.283 0.461
#> # ℹ 22 more rows
#>
#> $hex_poly
#> # A tibble: 192 × 3
#> hex_poly_id x y
#> <int> <dbl> <dbl>
#> 1 1 -0.1 0.0191
#> 2 1 -0.291 -0.0914
#> 3 1 -0.291 -0.312
#> 4 1 -0.1 -0.423
#> 5 1 0.0915 -0.312
#> 6 1 0.0915 -0.0914
#> 7 2 0.283 0.0191
#> 8 2 0.0915 -0.0914
#> 9 2 0.0915 -0.312
#> 10 2 0.283 -0.423
#> # ℹ 182 more rows
#>
#> $data_hb_id
#> # 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
#>
#> $std_cts
#> # A tibble: 11 × 3
#> hb_id n std_counts
#> <int> <int> <dbl>
#> 1 5 14 1
#> 2 6 3 0.214
#> 3 9 3 0.214
#> 4 10 6 0.429
#> 5 14 9 0.643
#> 6 15 2 0.143
#> 7 19 11 0.786
#> 8 23 4 0.286
#> 9 27 9 0.643
#> 10 28 9 0.643
#> 11 31 5 0.357
#>
#> $tot_bins
#> [1] 32
#>
#> $non_bins
#> [1] 11
#>
#> $pts_bins
#> # A tibble: 11 × 2
#> hexID pts_list
#> <int> <named list>
#> 1 5 <int [75]>
#> 2 19 <int [75]>
#> 3 10 <int [75]>
#> 4 31 <int [75]>
#> 5 14 <int [75]>
#> 6 28 <int [75]>
#> 7 9 <int [75]>
#> 8 23 <int [75]>
#> 9 15 <int [75]>
#> 10 6 <int [75]>
#> 11 27 <int [75]>
#>
#> attr(,"class")
#> [1] "hex_bin_obj"