Update Status Code
update_status_code.Rd
update_status_code()
updates an existing status code in the status code lookup table
Arguments
- con
A DBI connection object obtained from DBI::dbConnect()
- status_code_id
A numeric ID for the targeted status code
get_status_codes
- status_code
A valid status code dataframe containing the following:
status_code Status code full name
description Brief description of the status code
See also
Other status code functions:
add_status_code()
,
delete_status_code()
,
get_sample_status()
,
get_status_codes()
,
set_sample_status()
,
update_status_code_status()
Examples
# example database connection
cfg <- config::get()
con <- DBI::dbConnect(RPostgres::Postgres(),
dbname = cfg$dbname,
host = cfg$host,
port = cfg$port,
user = cfg$username,
password = cfg$password)
#> Error: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061)
#> Is the server running on that host and accepting TCP/IP connections?
#> connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (0x0000274D/10061)
#> Is the server running on that host and accepting TCP/IP connections?
all_status_codes <- get_status_codes(con)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'dbObj' in selecting a method for function 'dbIsValid': object 'con' not found
View(all_status_codes) # to view the ID of the status code needing updates
#> Error in eval(expr, envir, enclos): object 'all_status_codes' not found
updated_status_code <- all_status_codes[1, 2:3]
#> Error in eval(expr, envir, enclos): object 'all_status_codes' not found
updated_status_code$status_code <- "New all done"
#> Error: object 'updated_status_code' not found
update_status_code(con, 1, updated_status_code)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'dbObj' in selecting a method for function 'dbIsValid': object 'con' not found