Learn R Programming

cubar (version 1.2.0)

slide: Generate sliding window intervals

Description

slide creates a data.table defining sliding window positions for analyzing sequences or data along a continuous range. This function provides the foundation for positional analyses of codon usage patterns within genes.

Usage

slide(from, to, step = 1, before = 0, after = 0)

Value

A data.table with three columns:

  • start: Start position of each window

  • center: Center position of each window

  • end: End position of each window

Arguments

from

Integer specifying the start position of the analysis range.

to

Integer specifying the end position of the analysis range.

step

Integer specifying the step size between consecutive window centers (default: 1). Larger values create non-overlapping or less overlapping windows.

before

Integer specifying the number of positions to include before the window center (default: 0). Determines the left boundary of each window.

after

Integer specifying the number of positions to include after the window center (default: 0). Determines the right boundary of each window.

Examples

Run this code
# Create sliding windows with step size 2 and window size 3
slide(1, 10, step = 2, before = 1, after = 1)

Run the code above in your browser using DataLab