New to R. Looking to replace the entire string if there is a partial match.
d = c(\"SDS0G2 Blue\", \"Blue SSC2CWA3\", \"Blue SA2M1GC\", \"SA5 Blue CSQ5\")
I'd suggest using grepl to find the indices and replace those indices with "Red":
grepl
d = c("SDS0G2 Blue", "Blue SSC2CWA3", "Blue SA2M1GC", "SA5 Blue CSQ5", "ABCDE") d[grepl("Blue", d, ignore.case=FALSE)] <- "Red" d # [1] "Red" "Red" "Red" "Red" "ABCDE"