title: R trying to find latitude/longitude data for cities in europe and getting geocode error messege
body: <p>I recently posted a question regarding plotting postions on cities in europe as points on a map.
  See <a href="https://stackoverflow.com/questions/20936840/r-get-longitude-latitude-data-for-cities-and-add-it-to-my-dataframe">R, get longitude/latitude data for cities and add it to my dataframe</a></p>
  
  <p>cities xlsx file contains about 20000 cities in europe.</p>
  
  <p>I got an error message when trying to find the latitude/longitude data using geocode. I have inserted part of the code below:</p>
  
  <pre><code>cities &lt;- read.xlsx("EU_city.xlsx",1)
  
  # get frequencies
  freq &lt;- as.data.frame(table(cities))
  library(plotrix)
  freq$Freq &lt;- rescale(freq$Freq, c(1,10)) # c(scale_min, scale_max)
  
  # get cities latitude/longitude - kindly provided by google:
  library(ggmap)
  lonlat &lt;- geocode(unique(cities)) 
  cities &lt;- cbind(freq, lonlat)
  
  error message:
  
  Error: is.character(location) is not TRUE
  </code></pre>
  
  <p>I guess the data(cities) in my dataframe is not found in the geocode call.
  Is there a way to ignore the city in the dtaframe if it is not matched in geocode </p>
  
  <p>Update of question after suggestion.......</p>
  
  <p>tried  geocode(as.character(cities))</p>
  
  <p>Then my frame looks like this:</p>
  
  <pre><code>&gt; cities &lt;- cbind(freq, lonlat)
  &gt; cities
                         cities  Freq lon lat
  1                      ARNHEM  1.00  NA  NA
  2                      ATHENS  3.25  NA  NA
  3                        BAAR  1.00  NA  NA
  4                BAD  VILBEL   1.00  NA  NA
  5                   BILTHOVEN  1.00  NA  NA
  6                      BOCHUM 10.00  NA  NA
  7                       BREDA  3.25  NA  NA
  8              CAMBRIDGESHIRE  3.25  NA  NA
  9                   DORDRECHT  1.00  NA  NA
  10                GAOETERSLOH  1.00  NA  NA
  11              GELSENKIRCHEN  1.00  NA  NA
  12                       GOES  1.00  NA  NA
  13                  GRONINGEN  3.25  NA  NA
  14  GUMMERSBACH-DIERINGHAUSEN  1.00  NA  NA
  15                  HALSTEREN  1.00  NA  NA
  16                   HANNOVER  1.00  NA  NA
  17                 HARDERWIJK  1.00  NA  NA
  18                    HEERLEN  3.25  NA  NA
  19                  HILVERSUM  1.00  NA  NA
  </code></pre>
  
  <p>I got no long/lat data at all, only NA</p>