table_updateSingleRecord: Update a single known location record in a table

View source: R/table_updateSingleRecord.R

table_updateSingleRecordR Documentation

Update a single known location record in a table

Description

Information in the locationList is used to replace existing information found in locationTbl. This function can be used for small tweaks to an existing locationTbl. Wholesale replacement of records should be performed with table_removeRecord() followed by table_addLocation().

Usage

table_updateSingleRecord(
  locationTbl = NULL,
  locationList = NULL,
  verbose = TRUE
)

Arguments

locationTbl

Tibble of known locations.

locationList

List containing locationID and one or more named columns whose values are to be replaced.

verbose

Logical controlling the generation of progress messages.

Value

Updated tibble of known locations.

See Also

table_addLocation

table_addSingleLocation

table_removeRecord

Examples

library(MazamaLocationUtils)

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

# Wenatchee
wenatcheeRecord <- 
  locationTbl %>% 
  dplyr::filter(city == "Wenatchee")

str(wenatcheeRecord)

wenatcheeID <- wenatcheeRecord$locationID

locationTbl <- table_updateSingleRecord(
  locationTbl,
  locationList = list(
    locationID = wenatcheeID,
    locationName = "Wenatchee-Fifth St"
  )
)

# Look at the new record
locationTbl %>% 
  dplyr::filter(city == "Wenatchee") %>%
  str()


MazamaLocationUtils documentation built on Sept. 11, 2024, 9:08 p.m.