fix_sboe_id_missing <- function(sboe_id, report_id) { idx_missing <- which(sboe_id == "No Id") if (!length(idx_missing)) { return(sboe_id) } sboe_id[idx_missing] <- paste0("NOID-", report_id[idx_missing]) sboe_id }