Learn R Programming

CDSim (version 0.1.1)

create_stations: Create or load station metadata

Description

Create a station metadata table (Station, LON, LAT) either by:

  • loading from a CSV file,

  • accepting an existing data.frame,

  • or auto-generating synthetic stations in a bounding box.

Usage

create_stations(
  source = NULL,
  n = 10,
  bbox = c(-3.5, 1.5, 4.5, 11.5),
  seed = NULL
)

Value

A data.frame with columns Station, LON, LAT.

Arguments

source

Path to CSV file OR a data.frame with Station/LON/LAT OR NULL (to generate synthetic).

n

Integer number of stations to generate when source = NULL. Default 10.

bbox

numeric vector c(min_lon, max_lon, min_lat, max_lat). Default ~ Ghana bounding box.

seed

Optional numeric to make generation reproducible.

Examples

Run this code
create_stations(n = 5, seed = 42)
create_stations(data.frame(Station="A", LON=0, LAT=5))

Run the code above in your browser using DataLab