I have a column of data with strings that have spaces - some strings have a single space and some have multiple (eg. X Y vs X Y Z). The code segment below worked well for a single space removal (making X Y to X_Y) but doesn't seem to work for multiple spaces - X Y Z becomes X_Y Z.
all_data$`Facility Name` <- str_replace(all_data$`Facility Name`, pattern = " ", replacement = "_")