I have a column of a large data frame containing regions sampled. However I have found that a number of the entries contain spaces following the regions name e.g. "East ". This is causing me problems for my analysis as R reads this as a different region to "East". Is there a way I can get rid of these spaces?
I have tried:
gsub(" ", "", df$Region)
but it doesn't seem to work.
Apologies for my ignorance I am new to R.
Many thanks!