replaceInspectionId: Replace values in columns inspection_id

View source: R/setGlobalInspectionID.R

replaceInspectionIdR Documentation

Replace values in columns inspection_id

Description

Replace values in columns inspection_id

Usage

replaceInspectionId(inspection.data, new_ids)

Arguments

inspection.data

list with inspections data frame in element inspections and observations data frame in element observations. Both data frames must have a column inspection_id.

new_ids

vector of as many inspection ids as there are rows in inspection.data$inspections to be given to the inspections in that data frame. The first element is given to the first row, the second to the second row, and so on.

Value

list with data frames in elements inspections and observations. In each data frame the values in column inspection_id are updated according to the new_ids.

Examples

inspection.data <- list(
  inspections = data.frame(
    inspection_id = 1:3,
    pipe_id = 1:3
  ),
  observations = data.frame(
    inspection_id = c(1, 1, 2, 2, 3, 3),
    observation = c("start", "end", "start", "end", "start", "end")
  )
)
replaceInspectionId(inspection.data, new_ids = paste0("id_", 1:3))


KWB-R/kwb.en13508.2 documentation built on Feb. 1, 2025, 12:32 p.m.