I am trying to replace the word "United States" with "USA" to colour a choropleth map for a project. This is the code I am using on my data frame:
country_data_map$region[country_data_map$region == "United States"] <- "USA"
tail(country_data_map,20)
but it still prints out
region value
<chr> <chr>
208 Turkmenistan 73,08
209 Turks & Caicos Is 15,67
210 Tuvalu 20,03
211 Uganda 67,83
212 Ukraine 20,34
213 United Arab Emirates 14,51
214 United Kingdom 5,16
215 United States 6,5
216 Uruguay 11,95
217 Uzbekistan 71,1
218 Vanuatu 55,16
219 Venezuela 22,2
220 Vietnam 25,95
221 Virgin Islands 8,03
222 Wallis and Futuna
223 West Bank 19,62
224 Western Sahara
225 Yemen 61,5
226 Zambia 88,29
227 Zimbabwe 67,69
Does anyone know what I am doing wrong?
tail(country_data_map,20). The issue could be a number of things (extra spaces, for example), and a snippet of data would help us copy and paste your data into R and test some things.