使用twitteR包searchTwitter()函数,按位置与全局搜索推文结果不同的原因
searchTwitter() Let me break down the key reasons for this discrepancy based on how Twitter's underlying API (which the twitteR package wraps) handles geographically constrained searches:
Geotagging Requirement
When you specify a location/radius insearchTwitter(), the API only returns tweets that have explicit geographic metadata attached. This includes:- Tweets posted with GPS coordinates enabled (the user allowed location tracking when posting)
- Tweets where the user's profile location was successfully resolved to a geographic area within your specified range
In contrast, the global search pulls all tweets containing your keywords—regardless of whether they have any location data attached. Since most users don't enable geotagging for their tweets, this instantly creates a much larger pool of results for the global search.
Potential Gaps in "Global" Location Coverage
Even if you intended to cover the entire globe, there might be issues with how you defined the location parameter:- Twitter's API has a maximum radius limit (2500 kilometers) for circle-based location searches. If you used a single center point with a radius smaller than this, you might have missed regions outside that circle.
- If you used a bounding box, double-check that it properly spans from -180° to 180° longitude and -90° to 90° latitude—any gaps here would exclude tweets from those areas.
Search Index and Result Prioritization
Twitter's search algorithm prioritizes different result sets for geographic vs. global searches. Geographically constrained searches pull from a subset of the index focused on geotagged content, which may not include every relevant tweet even if it's technically within your location range. Global searches, on the other hand, query the full tweet index, leading to more matches.Rate Limiting and Result Truncation
While both searches are constrained to 1-2 days, the smaller pool of geotagged tweets might hit the API's rate limits or result truncation thresholds faster—but more likely, the sheer volume of non-geotagged tweets in the global search simply means there are more results available to return within the same time window.
内容的提问来源于stack exchange,提问作者Kharoof

