title: Get coordinates of country location using lookup_coords() function from rtweet package
body: <p>I have installed rtweet and when I want to collect tweets from a specific country other than USA, the package doesn´t collect any data. I have already installed the <strong>Geocoding API</strong>, <strong>Maps JavaScript API</strong> and the <strong>Geolocation API</strong> with the same API key from Google as an environment variable in R. Here are the steps I followed:</p>
  
  <p>generate a google maps_token</p>
  
  <pre><code>google_maps_token&lt;-"my key XXXXXXXXXX"
  </code></pre>
  
  <p>path of home directory</p>
  
  <pre><code>home_directory &lt;- path.expand("~/")
  </code></pre>
  
  <p>combine with name for token</p>
  
  <pre><code>file_name &lt;- file.path(home_directory, "google_maps_token.rds")
  </code></pre>
  
  <p>save token to home directory</p>
  
  <pre><code>saveRDS(google_maps_token, file = file_name)
  </code></pre>
  
  <p>Create an environment variable</p>
  
  <pre><code>cat(paste0("GOOGLE_MAPS_PAT=", file_name),
  file = file.path(home_directory, ".Renviron"),
  append = TRUE)
  </code></pre>
  
  <p>Visualize API key envirnomental variables</p>
  
  <pre><code>usethis::edit_r_environ() 
  </code></pre>
  
  <p>TWITTER_PAT=/Users/xxxxxx/.rtweet_token1.rds
  GOOGLE_MAPS_PAT=/Users/xxxxxx//google_maps_token.rds</p>
  
  <p>After saving the google api key, I restart RStudio to start collecting tweets and this happens:</p>
  
  <p>load rtweet library</p>
  
  <pre><code>library(rtweet)
  </code></pre>
  
  <p>collect tweets from USA </p>
  
  <pre><code>tweets_USA &lt;- search_tweets("#lang:en",
                          geocode = lookup_coords("USA",apikey = "google_maps_token"),
                  n=10, include_rts = FALSE)
  </code></pre>
  
  <p>Searching for tweets...
  Finished collecting tweets!</p>
  
  <p><a href="https://i.stack.imgur.com/kayCz.png" rel="nofollow noreferrer">10 tweets from USA</a></p>
  
  <p>collect tweets from Mexico  </p>
  
  <pre><code>tweets_Mexico &lt;- search_tweets("#lang:es",
                             geocode = lookup_coords("mexico",apikey = "google_maps_token"),
                  n=10, include_rts = FALSE)
  </code></pre>
  
  <p>Searching for tweets...
  Finished collecting tweets!</p>
  
  <p><a href="https://i.stack.imgur.com/tftnC.png" rel="nofollow noreferrer">no data collected from Mexico</a></p>
  
  <p>Also, when I use the lookup_coords() function from rtweet package with "usa" it works</p>
  
  <p>get coordinates from USA</p>
  
  <pre><code>usa &lt;- lookup_coords("usa")
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/kUjJi.png" rel="nofollow noreferrer">coordinates from USA</a> </p>
  
  <p>but when I try to use another address following the examples in the help section it does not collect any data</p>
  
  <p>get coordinates from Brazil</p>
  
  <pre><code>bz &lt;- lookup_coords("brazil")
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/0OjKJ.png" rel="nofollow noreferrer">no coordinates from Brazil</a></p>
  
  <p>But when I directly write the API key in the function it works.
  For security reasons I write instead "XXXXXXXXXX"</p>
  
  <pre><code>mexico_coord &lt;- lookup_coords(address = "mexico",
                            components = "country:Mexico",
                            apikey = "XXXXXXXXXXXX") 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6JEfe.png" rel="nofollow noreferrer">mexico coordinates</a></p>
  
  <p>Am I doing something wrong or do I need to install the API key in another directory? I have to say that my working directory (where I save my projects and scripts) is different from the home directory that appears as a result of running  path.expand("~/")</p>