I am using 'rtweet' package to collect tweets by location.
rt <- search_tweets(
"lang:en", lookup_coords("san francisco, CA", "country:US"), n = 10000
I get the following error when I mention city, state and country.
Error: can only select one search type. Try type = 'recent'
The documentation for rtweet::search_tweets tells that you need to specify which type of tweet you are looking for. There are three options to choose from: "recent", "popular", "mixed". You need to specify them in your call.
Here is a call to search tweets that will not throw an error (the coordinates I specified are in San Francisco, and I set a radius of 40 kilometers. I also picked a term that I am certain will return matches)
first_batch <- rtweet::search_tweets(q= "Kanye",
geocode = "37.773972,-122.431297,40km", n = 100, type = "recent",
retryonratelimit = TRUE, parse = TRUE)
I changed your call slightly, so it doesn't throw an error, but the search was retrieving 0 tweets (I think because the lookup_coords was returning empty)
second_batch <- rtweet::search_tweets(q= "Kanye",
geocode = rtweet::lookup_coords("San Francisco, CA", "country:US"), n = 100, type = "recent",
retryonratelimit = TRUE, parse = TRUE)
I have searched for tweets based on location before, and I advise you to use the first method. Grab latitude and longitude from Google, and set up a radius. Then pass them into the function with a search term and specifying the type parameter.