How to add "swab" to text string when "dry0" occurs in R
I have a column with swab IDs. The normal ID nomenclature is "dryswab00001". However there are some samples as "dry00135". How would I str_detect those IDs and insert "swab" before the leading zero/number? Data data <- structure(list(swab_id = c("dryswab00001", "dry00002")), class = "data.frame", row.names = c(NA, -2L)) >Solution : You can use str_detect and str_replace… Read More How to add "swab" to text string when "dry0" occurs in R