-
Notifications
You must be signed in to change notification settings - Fork 198
error with lookup_coords #261
Comments
Seconded. rtweet::lookup_coords("UK")
#> Error in if (interactive) {: argument is not interpretable as logical
rtweet::lookup_coords("london")
#> Error in if (interactive) {: argument is not interpretable as logical
rtweet::lookup_coords("michigan")
#> Error in if (interactive) {: argument is not interpretable as logical
rtweet::lookup_coords("California")
#> Error in if (interactive) {: argument is not interpretable as logical
rtweet::lookup_coords("California, US")
#> Error in if (interactive) {: argument is not interpretable as logical
#but interestingly
rtweet::lookup_coords("USA")
#> $place
#> [1] "USA"
#>
#> $box
#> sw.lng sw.lat ne.lng ne.lat
#> -124.84897 24.39631 -66.88544 49.38436
#>
#> $point
#> lat lng
#> 36.890 -95.867
#>
#> attr(,"class")
#> [1] "coords" "list"
```
Created on 2018-08-01 by the [reprex package](http://reprex.tidyverse.org) (v0.2.0.9000).
<details><summary>Session info</summary>
``` r
devtools::session_info()
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.4.4 (2018-03-15)
#> system x86_64, darwin15.6.0
#> ui X11
#> language (EN)
#> collate en_GB.UTF-8
#> tz Europe/London
#> date 2018-08-01
#> Packages -----------------------------------------------------------------
#> package * version date source
#> backports 1.1.2 2017-12-13 CRAN (R 3.4.3)
#> base * 3.4.4 2018-03-15 local
#> compiler 3.4.4 2018-03-15 local
#> datasets * 3.4.4 2018-03-15 local
#> devtools 1.13.5 2018-02-18 CRAN (R 3.4.3)
#> digest 0.6.15 2018-01-28 CRAN (R 3.4.3)
#> evaluate 0.11 2018-07-17 cran (@0.11)
#> graphics * 3.4.4 2018-03-15 local
#> grDevices * 3.4.4 2018-03-15 local
#> htmltools 0.3.6 2017-04-28 cran (@0.3.6)
#> httr 1.3.1 2017-08-20 CRAN (R 3.4.1)
#> jsonlite 1.5 2017-06-01 CRAN (R 3.4.0)
#> knitr 1.20 2018-02-20 CRAN (R 3.4.3)
#> magrittr 1.5 2014-11-22 CRAN (R 3.4.0)
#> memoise 1.1.0 2017-04-21 CRAN (R 3.4.0)
#> methods * 3.4.4 2018-03-15 local
#> R6 2.2.2 2017-06-17 CRAN (R 3.4.0)
#> Rcpp 0.12.17 2018-05-18 cran (@0.12.17)
#> rmarkdown 1.10 2018-06-11 cran (@1.10)
#> rprojroot 1.3-2 2018-01-03 CRAN (R 3.4.2)
#> rtweet 0.6.7 2018-06-20 CRAN (R 3.4.4)
#> stats * 3.4.4 2018-03-15 local
#> stringi 1.2.4 2018-07-20 cran (@1.2.4)
#> stringr 1.3.1 2018-05-10 cran (@1.3.1)
#> tools 3.4.4 2018-03-15 local
#> utils * 3.4.4 2018-03-15 local
#> withr 2.1.2 2018-03-15 CRAN (R 3.4.4)
#> yaml 2.1.19 2018-05-01 cran (@2.1.19)
```
</details> |
@sefabey the fix isn't to CRAN yet (tho it will be soon). Try the dev version on Github: devtools::install_github("mkearney/rtweet")
library(rtweet)
lookup_coords("England, UK") If you're in an interactive session, it should then ask you for your google maps API key (and it will display some instructions on how to get one). And, for the record, the US and World coordinates are hardwired in (i was hitting those hard for a while, and it seemed like a waste to hit up the Google maps API each time). So those locations should return coordinates regardless of whether you have a google maps API key saved as an environment variable. |
Okay, tried that. After installing GH version and typing in the GMaps API key, I still get this. library(rtweet)
rtweet::lookup_coords("UK")
#> $place
#> [1] "UK"
#>
#> $box
#> NULL
#>
#> $point
#> NULL
#>
#> attr(,"class")
#> [1] "coords" "list"
rtweet::lookup_coords("london")
#> $place
#> [1] "london"
#>
#> $box
#> NULL
#>
#> $point
#> NULL
#>
#> attr(,"class")
#> [1] "coords" "list"
rtweet::lookup_coords("michigan")
#> $place
#> [1] "michigan"
#>
#> $box
#> NULL
#>
#> $point
#> NULL
#>
#> attr(,"class")
#> [1] "coords" "list"
rtweet::lookup_coords("California")
#> $place
#> [1] "California"
#>
#> $box
#> NULL
#>
#> $point
#> NULL
#>
#> attr(,"class")
#> [1] "coords" "list"
rtweet::lookup_coords("California, US")
#> $place
#> [1] "California, US"
#>
#> $box
#> NULL
#>
#> $point
#> NULL
#>
#> attr(,"class")
#> [1] "coords" "list"
#but as you mentioned
rtweet::lookup_coords("USA")
#> $place
#> [1] "USA"
#>
#> $box
#> sw.lng sw.lat ne.lng ne.lat
#> -124.84897 24.39631 -66.88544 49.38436
#>
#> $point
#> lat lng
#> 36.890 -95.867
#>
#> attr(,"class")
#> [1] "coords" "list"
#also
lookup_coords("England, UK")
#> $place
#> [1] "England, UK"
#>
#> $box
#> NULL
#>
#> $point
#> NULL
#>
#> attr(,"class")
#> [1] "coords" "list"
#lastly
search_tweets("london", n=50, geocode = lookup_coords("London"))
#> Searching for tweets...
#> Finished collecting tweets!
#> data frame with 0 columns and 0 rows
search_tweets("london", n=50, geocode = lookup_coords("London, UK"))
#> Searching for tweets...
#> Finished collecting tweets!
#> data frame with 0 columns and 0 rows Created on 2018-08-01 by the reprex package (v0.2.0.9000). Session infodevtools::session_info()
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.4.4 (2018-03-15)
#> system x86_64, darwin15.6.0
#> ui X11
#> language (EN)
#> collate en_GB.UTF-8
#> tz Europe/London
#> date 2018-08-01
#> Packages -----------------------------------------------------------------
#> package * version date source
#> backports 1.1.2 2017-12-13 CRAN (R 3.4.3)
#> base * 3.4.4 2018-03-15 local
#> compiler 3.4.4 2018-03-15 local
#> curl 3.2 2018-03-28 CRAN (R 3.4.4)
#> datasets * 3.4.4 2018-03-15 local
#> devtools 1.13.5 2018-02-18 CRAN (R 3.4.3)
#> digest 0.6.15 2018-01-28 CRAN (R 3.4.3)
#> evaluate 0.11 2018-07-17 cran (@0.11)
#> graphics * 3.4.4 2018-03-15 local
#> grDevices * 3.4.4 2018-03-15 local
#> htmltools 0.3.6 2017-04-28 cran (@0.3.6)
#> httr 1.3.1 2017-08-20 CRAN (R 3.4.1)
#> jsonlite 1.5 2017-06-01 CRAN (R 3.4.0)
#> knitr 1.20 2018-02-20 CRAN (R 3.4.3)
#> magrittr 1.5 2014-11-22 CRAN (R 3.4.0)
#> memoise 1.1.0 2017-04-21 CRAN (R 3.4.0)
#> methods * 3.4.4 2018-03-15 local
#> openssl 1.0.1 2018-03-03 CRAN (R 3.4.3)
#> R6 2.2.2 2017-06-17 CRAN (R 3.4.0)
#> Rcpp 0.12.17 2018-05-18 cran (@0.12.17)
#> rmarkdown 1.10 2018-06-11 cran (@1.10)
#> rprojroot 1.3-2 2018-01-03 CRAN (R 3.4.2)
#> rtweet * 0.6.7.9000 2018-08-01 Github (mkearney/rtweet@9030b46)
#> stats * 3.4.4 2018-03-15 local
#> stringi 1.2.4 2018-07-20 cran (@1.2.4)
#> stringr 1.3.1 2018-05-10 cran (@1.3.1)
#> tools 3.4.4 2018-03-15 local
#> utils * 3.4.4 2018-03-15 local
#> withr 2.1.2 2018-03-15 CRAN (R 3.4.4)
#> yaml 2.1.19 2018-05-01 cran (@2.1.19) |
Not directly related to Not sure if this is an issue with the That said, I am not sure if |
It does, but that inconsistency should be fixed by forcing users to supply their own API key. RE: your code still not working: Have you tried restarting your session? And what did you label your google maps API key environment variable? Make sure it includes Sys.getenv("GOOGLE_MAPS_KEY") |
Edit: Not to self: Gotta be more careful before publishing API keys online. Yes, restarted the session, even Rstudio. I have been working on a new setup so had no Google Maps API key provided previously. When I installed the latest GH version of Ultimately, what I still get is: library(rtweet)
rtweet::lookup_coords("UK")
#> $place
#> [1] "UK"
#>
#> $box
#> NULL
#>
#> $point
#> NULL
#>
#> attr(,"class")
#> [1] "coords" "list"
rtweet::lookup_coords("London")
#> $place
#> [1] "London"
#>
#> $box
#> NULL
#>
#> $point
#> NULL
#>
#> attr(,"class")
#> [1] "coords" "list"
rtweet::lookup_coords("michigan")
#> $place
#> [1] "michigan"
#>
#> $box
#> NULL
#>
#> $point
#> NULL
#>
#> attr(,"class")
#> [1] "coords" "list"
rtweet::lookup_coords("California")
#> $place
#> [1] "California"
#>
#> $box
#> NULL
#>
#> $point
#> NULL
#>
#> attr(,"class")
#> [1] "coords" "list"
lookup_coords("England, UK")
#> $place
#> [1] "England, UK"
#>
#> $box
#> NULL
#>
#> $point
#> NULL
#>
#> attr(,"class")
#> [1] "coords" "list"
search_tweets("london", n=50, geocode = lookup_coords("London"))
#> Searching for tweets...
#> Finished collecting tweets!
#> data frame with 0 columns and 0 rows
search_tweets("london", n=50, geocode = lookup_coords("London, UK"))
#> Searching for tweets...
#> Finished collecting tweets!
#> data frame with 0 columns and 0 rows
ggmap::geocode("houston texas")
#> Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=houston%20texas&sensor=false
#> lon lat
#> 1 -95.3698 29.76043
ggmap::geocode("London")
#> Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=London&sensor=false
#> lon lat
#> 1 -0.1277583 51.50735
Sys.getenv("GOOGLE_MAPS_KEY")
#> [1] "AIzaSyCap9hNxpTXXXXXXXXXXXXXXXXXXX" Created on 2018-08-01 by the reprex package (v0.2.0.9000). Session infodevtools::session_info()
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.4.4 (2018-03-15)
#> system x86_64, darwin15.6.0
#> ui X11
#> language (EN)
#> collate en_GB.UTF-8
#> tz Europe/London
#> date 2018-08-01
#> Packages -----------------------------------------------------------------
#> package * version date source
#> assertthat 0.2.0 2017-04-11 CRAN (R 3.4.0)
#> backports 1.1.2 2017-12-13 CRAN (R 3.4.3)
#> base * 3.4.4 2018-03-15 local
#> bindr 0.1.1 2018-03-13 CRAN (R 3.4.4)
#> bindrcpp 0.2.2 2018-03-29 CRAN (R 3.4.4)
#> colorspace 1.3-2 2016-12-14 CRAN (R 3.4.0)
#> compiler 3.4.4 2018-03-15 local
#> curl 3.2 2018-03-28 CRAN (R 3.4.4)
#> datasets * 3.4.4 2018-03-15 local
#> devtools 1.13.5 2018-02-18 CRAN (R 3.4.3)
#> digest 0.6.15 2018-01-28 CRAN (R 3.4.3)
#> dplyr 0.7.4 2017-09-28 CRAN (R 3.4.2)
#> evaluate 0.11 2018-07-17 cran (@0.11)
#> geosphere 1.5-7 2017-11-05 CRAN (R 3.4.2)
#> ggmap 2.6.1 2016-01-23 CRAN (R 3.4.0)
#> ggplot2 3.0.0 2018-07-03 CRAN (R 3.4.4)
#> glue 1.3.0 2018-07-17 cran (@1.3.0)
#> graphics * 3.4.4 2018-03-15 local
#> grDevices * 3.4.4 2018-03-15 local
#> grid 3.4.4 2018-03-15 local
#> gtable 0.2.0 2016-02-26 CRAN (R 3.4.0)
#> htmltools 0.3.6 2017-04-28 cran (@0.3.6)
#> httr 1.3.1 2017-08-20 CRAN (R 3.4.1)
#> jpeg 0.1-8 2014-01-23 CRAN (R 3.4.0)
#> jsonlite 1.5 2017-06-01 CRAN (R 3.4.0)
#> knitr 1.20 2018-02-20 CRAN (R 3.4.3)
#> lattice 0.20-35 2017-03-25 CRAN (R 3.4.4)
#> lazyeval 0.2.1 2017-10-29 CRAN (R 3.4.2)
#> magrittr 1.5 2014-11-22 CRAN (R 3.4.0)
#> mapproj 1.2.6 2018-03-29 CRAN (R 3.4.4)
#> maps 3.3.0 2018-04-03 CRAN (R 3.4.4)
#> memoise 1.1.0 2017-04-21 CRAN (R 3.4.0)
#> methods * 3.4.4 2018-03-15 local
#> munsell 0.4.3 2016-02-13 CRAN (R 3.4.0)
#> openssl 1.0.1 2018-03-03 CRAN (R 3.4.3)
#> pillar 1.2.1 2018-02-27 CRAN (R 3.4.3)
#> pkgconfig 2.0.1 2017-03-21 CRAN (R 3.4.0)
#> plyr 1.8.4 2016-06-08 CRAN (R 3.4.0)
#> png 0.1-7 2013-12-03 CRAN (R 3.4.0)
#> proto 1.0.0 2016-10-29 CRAN (R 3.4.0)
#> R6 2.2.2 2017-06-17 CRAN (R 3.4.0)
#> Rcpp 0.12.17 2018-05-18 cran (@0.12.17)
#> reshape2 1.4.3 2017-12-11 CRAN (R 3.4.3)
#> RgoogleMaps 1.4.2 2018-06-08 CRAN (R 3.4.4)
#> rjson 0.2.20 2018-06-08 CRAN (R 3.4.4)
#> rlang 0.2.1 2018-05-30 cran (@0.2.1)
#> rmarkdown 1.10 2018-06-11 cran (@1.10)
#> rprojroot 1.3-2 2018-01-03 CRAN (R 3.4.2)
#> rtweet * 0.6.7.9000 2018-08-01 Github (mkearney/rtweet@9030b46)
#> scales 0.5.0 2017-08-24 CRAN (R 3.4.1)
#> sp 1.2-7 2018-01-19 CRAN (R 3.4.3)
#> stats * 3.4.4 2018-03-15 local
#> stringi 1.2.4 2018-07-20 cran (@1.2.4)
#> stringr 1.3.1 2018-05-10 cran (@1.3.1)
#> tibble 1.4.2 2018-01-22 CRAN (R 3.4.3)
#> tools 3.4.4 2018-03-15 local
#> utils * 3.4.4 2018-03-15 local
#> withr 2.1.2 2018-03-15 CRAN (R 3.4.4)
#> yaml 2.1.19 2018-05-01 cran (@2.1.19) |
Well that's a tough one. Can you try this and see if the output matches your key: rtweet:::find_google_geocode_key() |
Otherwise I'm at a loss. The rtweet internal uses |
Aye, matches. See the reprex below. Are I can't imagine https being the problem. Could this be an issue on the server side? I find google maps APIS quite confusing. For instance, even though the recent change in google maps API re billing (no more free accounts, forcing users to set up billing accounts), identical(Sys.getenv("GOOGLE_MAPS_KEY"),rtweet:::find_google_geocode_key())
#> [1] TRUE
identical("AIzaSyCap9hNxpXXXXXXXXXXXXXXXXX",rtweet:::find_google_geocode_key())
#> [1] TRUE Created on 2018-08-01 by the reprex package (v0.2.0.9000). Session infodevtools::session_info()
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.4.4 (2018-03-15)
#> system x86_64, darwin15.6.0
#> ui X11
#> language (EN)
#> collate en_GB.UTF-8
#> tz Europe/London
#> date 2018-08-01
#> Packages -----------------------------------------------------------------
#> package * version date source
#> backports 1.1.2 2017-12-13 CRAN (R 3.4.3)
#> base * 3.4.4 2018-03-15 local
#> compiler 3.4.4 2018-03-15 local
#> datasets * 3.4.4 2018-03-15 local
#> devtools 1.13.5 2018-02-18 CRAN (R 3.4.3)
#> digest 0.6.15 2018-01-28 CRAN (R 3.4.3)
#> evaluate 0.11 2018-07-17 cran (@0.11)
#> graphics * 3.4.4 2018-03-15 local
#> grDevices * 3.4.4 2018-03-15 local
#> htmltools 0.3.6 2017-04-28 cran (@0.3.6)
#> httr 1.3.1 2017-08-20 CRAN (R 3.4.1)
#> jsonlite 1.5 2017-06-01 CRAN (R 3.4.0)
#> knitr 1.20 2018-02-20 CRAN (R 3.4.3)
#> magrittr 1.5 2014-11-22 CRAN (R 3.4.0)
#> memoise 1.1.0 2017-04-21 CRAN (R 3.4.0)
#> methods * 3.4.4 2018-03-15 local
#> R6 2.2.2 2017-06-17 CRAN (R 3.4.0)
#> Rcpp 0.12.17 2018-05-18 cran (@0.12.17)
#> rmarkdown 1.10 2018-06-11 cran (@1.10)
#> rprojroot 1.3-2 2018-01-03 CRAN (R 3.4.2)
#> rtweet 0.6.7.9000 2018-08-01 Github (mkearney/rtweet@9030b46)
#> stats * 3.4.4 2018-03-15 local
#> stringi 1.2.4 2018-07-20 cran (@1.2.4)
#> stringr 1.3.1 2018-05-10 cran (@1.3.1)
#> tools 3.4.4 2018-03-15 local
#> utils * 3.4.4 2018-03-15 local
#> withr 2.1.2 2018-03-15 CRAN (R 3.4.4)
#> yaml 2.1.19 2018-05-01 cran (@2.1.19) |
It's working like a charm for me on my Mac, PC, and Linux. Try updating jsonlite, httr, and if it's still not working then updating R (I think the current release is 3.5). |
Ok, you can close this issue now. I'm not sure why but this is working fine on my local Rstudio. Might be a Docker related issue. |
I am still having issues with this. Whats the solution please?
…On Tuesday, October 2, 2018, Sefa Ozalp ***@***.***> wrote:
Ok, you can close this issue now. I'm not sure why but this is working
fine on my local Rstudio. Might be a Docker related issue.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/mkearney/rtweet/issues/261#issuecomment-426355241>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AiR1cCGY6ZTQnG8RdOHdJJF8GFRuD0Nqks5ug55xgaJpZM4UxhOS>
.
|
Follow the suggestions in the thread, I'd say. Also, have you checked
If you see an API key and the latter return |
Mine doesnt give me the option.to enter an Api key. It just returns null
values
…On Tue, Oct 2, 2018, 8:44 PM Sefa Ozalp ***@***.***> wrote:
Follow the suggestions in the thread, I'd say.
Also, have you checked
Sys.getenv("GOOGLE_MAPS_KEY")
and
identical(Sys.getenv("GOOGLE_MAPS_KEY"),rtweet:::find_google_geocode_key())
?
If you see an API key and the latter return TRUE, it should work.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/mkearney/rtweet/issues/261#issuecomment-426405174>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AiR1cLVKCCHvsXEXRKc0e4n-Th_5oyzZks5ug8I5gaJpZM4UxhOS>
.
|
What does |
I have the same issue with vic. Got my google maps API from sys.getenv and a "true" from identical command. But still:
$box $point attr(,"class") |
I have the same problem. API identical, all locations are returned as NULL except US ones. |
I had the same problem, this is the way I solved it: When you are creating your API Key, make sure you select "places" and activate "Geocoding API", then just simply run "system("./.Renviron")" in Rstudio and update your API Key. Reset the session and everything should work perfectly. Hope this solves your problem. |
Had the same issue, and enabling the Geocoding API fixed it for me as well. Thanks! |
After changing the key to geocoding API key, lookup_coords() worked for a single time. But when I tried adding components="country:India" it again doesn't retrieves any tweets. And neither does it works for the code that worked initially. re=lookup_coords("india", components="country:India")
$box $point attr(,"class")
|
Geocoding API must be enable from Google Cloud Platform; billing must be enable too. |
Hi please help I am having errors trying to search by geo location in rtweet
here is my code
search_tweets("economy", n=100, geocode = lookup_coords("uk"))
the error is
Error in if (interactive) { : argument is not interpretable as logical
however it works if the search location is USA. please help!!!
The text was updated successfully, but these errors were encountered: