My dataset has hundreds column of data in data.frame, every column's header name is a city's name + its state's abbreviation. I am not sure what is the "separated sign" between the city's name and state's name, I want to delete all the city's name to get a new data.frame.
Like:
I tried this way, but it doesn't work, it seems like those words are not separated by ".."
Header = c(colnames(CityValue))
split_fun = function(str){
strsplit(str,"..")[[1]][1]
}
sapply(Header, split_fun)
I got :