Learn R Programming

PAMmisc (version 1.12.3)

dataToRanges: Create List of the Ranges of Coordinates

Description

Creates a named list with the ranges of Longitude, Latitude, and Time (UTC) data for use in functions like formatURL. Can also specify an amount to buffer the min and max values by for each coordinate

Usage

dataToRanges(data, buffer = c(0, 0, 0))

Value

a list with the ranges of coordinates for Longitude, Latitude, and UTC. Ranges are listed as c(left, right), so if your data spans across the dateline

Arguments

data

a data frame with longitude, latitude, and time (UTC) columns

buffer

a vector of the amount to buffer the min and max values of Longitude, Latitude, and UTC by (in that order)

Author

Taiki Sakai taiki.sakai@noaa.gov

Examples

Run this code

gps <- data.frame(Latitude = c(32, 32.1, 32.2, 32.2, 32.2),
                  Longitude = c(-110, -110.1, -110.2, -110.3, -110.4),
                  UTC = as.POSIXct(c('2000-01-01 00:00:00', '2000-01-01 00:00:10',
                                     '2000-01-01 00:00:20', '2000-01-01 00:00:30',
                                     '2000-01-01 00:00:40')))
dataToRanges(gps)

dataToRanges(gps, buffer = c(.05, .05, 86400))

Run the code above in your browser using DataLab