第一个用table(), 会把所有user的频数显示出来
table(testing$user)第二个就取交集算个数吧。
如果只看user == 2中,item也相同的个数,那么
testuser <- testing[testing$user == 2, ]trainuser <- trainuser[training$user == 2, ]
length(intersect(testuser, trainuser))
r语言dim函数怎么用计算数组的行数和列数 dim//和GET方式一样,先将参数放入List
params = new LinkedList<BasicNameValuePair>()
params.add(new BasicNameValuePair("param1", "Post方法"))//增加参数1
params.add(new BasicNameValuePair("param2", "第二个参数"))//增加参数2
try {
HttpPost postMethod = new HttpPost(baseUrl)//创建一个post请求
postMethod.setEntity(new UrlEncodedFormEntity(params, "utf-8"))//将参数填入POST Entity中
HttpResponse response = httpClient.execute(postMethod)//执行POST方法
Log.i(TAG, "resCode = " + response.getStatusLine().getStatusCode())//获取响应码
Log.i(TAG, "result = " + EntityUtils.toString(response.getEntity(), "utf-8"))//获取响应内容
} catch (UnsupportedEncodingException e) {
e.printStackTrace()
} catch (ClientProtocolException e) {
e.printStackTrace()
} catch (IOException e) {
e.printStackTrace()
}