我是R的新手,我正在尝试根据特定纬度/经度周围的特定主题标签找到推文,然后在地图上显示它们。我一直在尝试关注this以及followup。我已经尝试将代码复制并粘贴到R中以查看它是否有效但是我收到此错误“connect2twitter()中的错误:对象'OAuthFactory'找不到”当我放入时:
<?php $stateArray = array(); ?>
<?php while ($city->have_posts()):$city->the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>" style="text-decoration: none; color: #9c9c9c; ">
<?php
$state = the_field('state');
if (!in_array($state, $stateArray)):
echo $state;
array_push($stateArray, $state);
endif;
?>
</a>
<hr style="margin:0">
</li>
<?php endwhile; ?>
当我输入此代码时:
connect2twitter = function() {
# Set SSL certs globally
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))
reqURL = "https://api.twitter.com/oauth/request_token"
accessURL = "https://api.twitter.com/oauth/access_token"
authURL = "https://api.twitter.com/oauth/authorize"
consumerKey = 'PASTE YOUR KEY HERE'
consumerSecret = 'PASTE YOUR SECRET HERE'
twitCred = OAuthFactory$new(consumerKey=consumerKey,consumerSecret=consumerSecret,requestURL=reqURL,accessURL=accessURL,authURL=authURL)
twitCred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))
registerTwitterOAuth(twitCred)
}
connect2twitter() #execute function
任何帮助都将非常感谢。 或者,如果有人知道教程或代码,我想看看俄亥俄州的克利夫兰,其周围的半径。然后搜索不在克利夫兰的运动队的推文,看看它们是否出现在半径范围内并将这些点放在地图上。