2
How to assign E.R. to separate the city name ?
cid <- c(cidade1..SP.Brasil,cidade2...SP.Brasil,cidade3..SPDF.Brasil,cidade4...SPDF.Brasil)
In the sublime for example, this works:
\\.{3}[A-Z]{4}|\\.{3}[A-Z]{2}|\\.{2}[A-Z]{4}|\\.{2}[A-Z]{2}
But I cannot assign to a variable in rstudio.
pattern <- ".{3}[A-Z]{4}|.{3}[A-Z]{2}|.{2}[A-Z]{4}|.{2}[A-Z]{2}"
pattern <- "\.{3}[A-Z]{4}|\.{3}[A-Z]{2}|\.{2}[A-Z]{4}|\.{2}[A-Z]{2}"
pattern <- "\\.{3}[A-Z]{4}|\\.{3}[A-Z]{2}|\\.{2}[A-Z]{4}|\\.{2}[A-Z]{2}"
pattern <- regex(".{3}[A-Z]{4}|.{3}[A-Z]{2}|.{2}[A-Z]{4}|.{2}[A-Z]{2}")
pattern <- regex("\.{3}[A-Z]{4}|\.{3}[A-Z]{2}|\.{2}[A-Z]{4}|\.{2}[A-Z]{2}")
pattern <- regex("\\.{3}[A-Z]{4}|\\.{3}[A-Z]{2}|\\.{2}[A-Z]{4}|\\.{2}[A-Z]{2}")
c <- strsplit(cid, pattern, fixed = TRUE)
You want to take only the stretch
SP
orSPDF
?– rray
I want to get only the names of the cities. I switched Fixed to FALSE and it worked, but now I have a list : "city1". Brazil" "city2". Brazil" ...
– Fernando