R/table_updateSingleRecord.R
table_updateSingleRecord.Rd
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()
.
table_updateSingleRecord(
locationTbl = NULL,
locationList = NULL,
verbose = TRUE
)
Tibble of known locations.
List containing locationID
and one or more named
columns whose values are to be replaced.
Logical controlling the generation of progress messages.
Updated tibble of known locations.
library(MazamaLocationUtils)
locationTbl <- get(data("wa_monitors_500"))
# Wenatchee
wenatcheeRecord <-
locationTbl %>%
dplyr::filter(city == "Wenatchee")
str(wenatcheeRecord)
#> 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"
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()
#> tibble [1 × 13] (S3: tbl_df/tbl/data.frame)
#> $ locationID : chr "c26mvd3xm6"
#> $ locationName: chr "Wenatchee-Fifth St"
#> $ 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"