This has to be a simple sub or gsub but I can't seem to find it on soverflow. Likely a duplicate someplace, but somewhere I can't seem to find.
data
df <- data.frame(c1=c(1:4),c2=c("431, Dallas, TX", "c63728 , Denver, CO", ",New Orleans, LA", "somewhere,NY, NY"))
data desired
df.desired <- data.frame(c1=c(1:4),c2=c("Dallas, TX", "Denver, CO", "New Orleans, LA", "NY, NY"))
Edited for the good answer below by pasqui for what I asked, but I'm modifying the question slightly
I'd just like to remove the first string and comma. So I'd like it to work in below as well:
data
df <- data.frame(c1=c(1:4),c2=c("431, Dallas, TX, 75225", "c63728 , Denver, CO, 80121", ",New Orleans, LA", "somewhere,NY, NY"))
data desired
df.desired <- data.frame(c1=c(1:4),c2=c("Dallas, TX, 75225", "Denver, CO, 80121", "New Orleans, LA", "NY, NY"))