Learn R Programming

mappeR (version 2.0.2)

create_width_balanced_cover: Generate an overlapping cover of an interval

Description

This is a function that generates a cover of an interval \([a,b]\) with some number of (possibly) overlapping, evenly spaced, identical width subintervals.

Usage

create_width_balanced_cover(min_val, max_val, num_bins, percent_overlap)

Value

A 2D numeric array.

  • left_ends - The left endpoints of the cover intervals.

  • right_ends - The right endpoints of the cover intervals.

Arguments

min_val

The left endpoint \(a\). A real number.

max_val

The right endpoint \(b\). A real number.

num_bins

The number of cover intervals with which to cover the interval. A positive integer.

percent_overlap

How much overlap desired between the cover intervals (the percent of the intersection of each interval with its immediate neighbor relative to its length, e.g., \([0,2]\) and \([1,3]\) would have \(50\%\) overlap). A real number between 0 and 100, inclusive.

Examples

Run this code
create_width_balanced_cover(min_val=0, max_val=100, num_bins=10, percent_overlap=15)
create_width_balanced_cover(-11.5, 10.33, 100, 2)

Run the code above in your browser using DataLab