r - Split an address separated by comma -


i have data.frame of house sale transactions. @ moment address in format.

  1 accacia avenue,this town,this city,a10 1aa. 

is there way can split different columns in data.frame removing , @ same time?

i have created separate vector containing addresses.

the address in stored in address column of dataframe - data.

head(data$address) [1] 22 amesbury road, feltham (tw13 5hj) [2]flat 11, gloucester court, links road, london (w3 0ew) 

i need split

"address1", "address2", "address3" 

and need remove postcode within () have in separate field.

library(tidyr) df <- data.frame(address = c("1 accacia avenue,this town,this city,a10 1aa")) separate(df , address , c("country" , "town" , "city" , "street") , ",")    # country             town      city      street # 1 accacia avenue town city   a10 1aa 

these dummy columns can change column names per address


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -