Skip to contents

This function reads BED files from a specified directory or file path and combines them into a single data frame. BED files use 0-based coordinate starts, while this function transforms the coordinates to 1-based during import.

Usage

read_bed(path)

Arguments

path

A character string specifying the directory containing BED files or the file path to a single BED file.

Value

A data frame combining data from the BED files.

Details

This function can read multiple BED files from a directory or a single BED file from a specified path. It adds a 'filename' column with the name of the file, and combines the data frames from all files into one.

Examples

if (FALSE) {
# Read BED files from a directory
bed_data <- read_bed("path/to/directory")

# Read a single BED file
bed_data <- read_bed("path/to/file.bed")
}