Learn R Programming

GeoThinneR (version 1.0.0)

assign_coords_to_grid: Assign Geographic Coordinates to Grid Cells

Description

This function assigns a set of geographic coordinates (longitude and latitude) to grid cells based on a specified cell size.

Usage

assign_coords_to_grid(coords, cell_size)

Value

A character vector of grid cell identifiers, where each identifier is formatted as "x_y", representing the grid cell coordinates.

Arguments

coords

A data frame or matrix with two columns: longitude and latitude.

cell_size

Numeric value representing the size of each grid cell, typically in degrees.

Examples

Run this code
coords <- data.frame(long = c(-122.4194, 0), lat = c(37.7749, 0))
cell_size <- 1
assign_coords_to_grid(coords, cell_size)

Run the code above in your browser using DataLab