MazamaLocationUtils (version 0.1.6)

table_updateColumn: Update a column of metadata in a table

Description

For matching locationID records the assaociated locatioData is used to replace any existing value in columnName.

Usage

table_updateColumn(locationTbl = NULL, columnName = NULL,
  locationID = NULL, locationData = NULL, verbose = TRUE)

Arguments

locationTbl

Tibble of known locations, Default: NULL

columnName

Name to use for the new column, Default: NULL

locationID

Vector of locationID strings, Default: NULL

locationData

Vector of data to used at matching records, Default: NULL

verbose

Logical controlling the generation of progress messages.

Value

Updated tibble of known locations.

See Also

table_addColumn

table_removeColumn

Examples

Run this code
# NOT RUN {
locationTbl <- get(data("wa_monitors_500"))
wa <- get(data("wa_airfire_meta"))

# We will merge some metadata from wa into locationTbl

# Record indices for wa
wa_indices <- seq(5,65,5)
wa_sub <- wa[wa_indices,]

locationID <- table_getLocationID(locationTbl, wa_sub$longitude, wa_sub$latitude, radius = 500)
locationData <- wa_sub$siteName

locationTbl <- table_updateColumn(locationTbl, "siteName", locationID, locationData)

# Look at the data we attempted to merge
wa$siteName[wa_indices]

# And two columns from the updated locationTbl
locationTbl_indices <- table_getRecordIndex(locationTbl, locationID)
locationTbl[locationTbl_indices, c("city","siteName")]

# }

Run the code above in your browser using DataLab