Skip to content
Prev 173529 / 398503 Next

R grep & gsub issue - sign seems to be causing an issue...

I would like to use grep and gsub to manipulate a vector to make the names used consistent, i.e. reduce a level or two.  

However, here is what I found when I attempted to use grep and gsub:
[1] "House 1 Plot Plus +100" "House 2 Plot Plus +100" "House 3 Plot Plus -100" "House 4 Plot Plus -100" "House 1 Plus +100"      "House 2 Plus +100"     
[7] "House 3 Plus -100"      "House 4 Plus -100"
integer(0)

However,
[1] "House 1 Plot Plus +100" "House 2 Plot Plus +100" "House 1 Plot Plus +100" "House 4 Plot Plus -100" "House 1 Plus +100"      "House 2 Plus +100"     
[7] "House 3 Plus -100"      "House 4 Plus -100"

Thanks for any feedback that can be provided.