find_containing_bin: Return the bin location of a num given a range from start...

View source: R/snp_utils_plot.R

find_containing_binR Documentation

Return the bin location of a num given a range from start until end and a set number of bins.

Description

A short description...

Usage

find_containing_bin(start, end, num, num_bins = 50, return_full_df = F)

Arguments

start
end
num
num_bins
return_full_df

Details

If the number (num) is not between the start and end (num > start & num <= end), the function returns NA.

Value

A number or a dataframe

Examples

# Example 1
find_containing_bin(start = 5515473, end = 5515517, pos = 5515489, return_full_df = F)
# Example 2: bin changes when pos increase
a <- 10 ; b <- 95
sapply(c(1:30), function(x) { find_containing_bin(start = a, end = b, pos = a+x) })
# Example 3: returning NA when num not in the range
find_containing_bin(start = 50, end = 150, num = 40, return_full_df = F)

Ni-Ar/niar documentation built on Feb. 3, 2025, 9:25 a.m.