get_external_data {OtsuSeg}R Documentation

Download and load example data for OtsuSeg

Description

Downloads a ZIP file with example rasters and shapefiles from GitHub releases and optionally loads a specific file.

Usage

get_external_data(filename = NULL, path = tempdir(), load = FALSE)

Arguments

filename

Optional. The name of the file to return (after extraction).

path

Local directory to download and extract files. Default is a temp folder.

load

Logical. If TRUE, returns a loaded object (RasterLayer for .tif, sf for .shp). Default is FALSE.

Value

File path or loaded object if 'load = TRUE'.

Examples


# Download example data and list contents
data_dir <- get_external_data(path = tempdir())
list.files(data_dir)

# Load a specific raster file (.tif)
pre_fire <- get_external_data("NBRpre.tif", path = tempdir(), load = TRUE)
print(pre_fire)

# Load a specific shapefile (.shp)
shape_data <- get_external_data("shapefile_reference.shp", path = tempdir(), load = TRUE)
print(shape_data)



[Package OtsuSeg version 0.1.0 Index]