I have a whole list of misspelling and I would like to change the all in one go. Is there an easy way to do so without writing a massive ifelse statement?
vegas <- c("North Las Vegas","N Las Vegas", "LAS VEGAS", "Las vegas","N. Las Vegas", "las vegas", "Las Vegas", "Las Vegas ", "South Las Vegas", "La Vegas", "Las Vegas, NV", "LasVegas",
"110 Las Vegas", "C Las Vegas", "Henderson and Las vegas",
"las Vegas", "Las Vegas & Henderson", "Las Vegas East", "Las Vegas Nevada",
"Las Vegas NV", "Las Vegas Valley", "Las Vegas,", "Las Vegass",
"Las Vergas", "Los Vegas", "N E Las Vegas", "N W Las Vegas", "NORTH LAS VEGAS", "North Las Vegas ", "Vegas")
data <- structure(list(city = c("Las Vegas", "Henderson", "North Las Vegas",
"Boulder City", "N Las Vegas", "Paradise", "LAS VEGAS", "Nellis AFB",
"Las vegas", "Blue Diamond", "N. Las Vegas", "Summerlin", "Spring Valley",
"HENDERSON", "las vegas", "Enterprise", "Las Vegas", "Clark",
"Las Vegas ", "Nellis Air Force Base", "South Las Vegas", "henderson",
"Nellis Afb", "La Vegas", "Las Vegas, NV", "LasVegas", "Summerlin South",
"110 Las Vegas", "Black Rock City", "boulder city", "C Las Vegas",
"Centennial Hills", "Central Henderson", "Citibank", "City Center",
"Decatur", "Green Valley", "Henderson (Green Valley)", "Henderson and Las vegas",
"Henderston", "Hendserson", "Hnederson", "Lake Las Vegas", "Lake Mead",
"las Vegas", "Las Vegas & Henderson", "Las Vegas East", "Las Vegas Nevada",
"Las Vegas NV", "Las Vegas Valley", "Las Vegas,", "Las Vegass",
"Las Vergas", "Los Vegas", "N E Las Vegas", "N W Las Vegas",
"Nellis", "NELLIS AFB", "Nevada", "NORTH LAS VEGAS", "North Las Vegas ",
"Pahrump", "Seven Hills", "Sunrise", "Sunrise Manor", "Vegas",
"W Henderson", "W Spring Valley", "Whitney"), count = c(29361L,
4892L, 1547L, 269L, 26L, 24L, 19L, 16L, 14L, 12L, 12L, 11L, 9L,
8L, 8L, 7L, 5L, 4L, 4L, 4L, 4L, 3L, 3L, 2L, 2L, 2L, 2L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L)), row.names = c(NA, -69L), class = c("tbl_df",
"tbl", "data.frame"))
So correct spelling in each mispelled row to "Las Vegas".
Aucun commentaire:
Enregistrer un commentaire