Returns a vector of locationTbl row indexes for the locations associated with each locationID.

table_getRecordIndex(locationTbl = NULL, locationID = NULL, verbose = TRUE)

Arguments

locationTbl

Tibble of known locations.

locationID

Vector of locationID strings.

verbose

Logical controlling the generation of progress messages.

Value

Vector of locationTbl row indexes.

Examples

library(MazamaLocationUtils)

locationTbl <- get(data("wa_monitors_500"))

# Wenatchee
lon <- -120.325278
lat <- 47.423333

# Get the locationID first
locationID <- table_getLocationID(locationTbl, lon, lat, distanceThreshold = 5000)

# Now find the row associated with this ID
recordIndex <- table_getRecordIndex(locationTbl, locationID)

str(locationTbl[recordIndex,])
#> tibble [1 × 13] (S3: tbl_df/tbl/data.frame)
#>  $ locationID  : chr "c26mvd3xm6"
#>  $ locationName: chr "us.wa_c26mvd"
#>  $ longitude   : num -120
#>  $ latitude    : num 47.4
#>  $ elevation   : num 249
#>  $ countryCode : chr "US"
#>  $ stateCode   : chr "WA"
#>  $ countyName  : chr "Chelan"
#>  $ timezone    : chr "America/Los_Angeles"
#>  $ houseNumber : chr NA
#>  $ street      : chr NA
#>  $ city        : chr "Wenatchee"
#>  $ postalCode  : chr "98801"