{"id":595,"date":"2017-07-04T10:20:42","date_gmt":"2017-07-04T02:20:42","guid":{"rendered":"https:\/\/www.beneplot.com\/?p=595"},"modified":"2020-07-23T15:15:41","modified_gmt":"2020-07-23T07:15:41","slug":"%e9%a2%98%e7%9b%ae%e7%ad%9b%e9%80%89%e7%ae%97%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.beneplot.com\/?p=595","title":{"rendered":"\u9898\u76ee\u7b5b\u9009\u7b97\u6cd5 &#8211; R\u8bed\u8a00"},"content":{"rendered":"<h3>\u5982\u4eca\uff0c\u5728\u7ebf\u6d4b\u8bd5\u8d8a\u6765\u8d8a\u591a\uff0c\u5728\u7ebf\u9898\u5e93\u7684\u4f7f\u7528\u4e5f\u66f4\u52a0\u9891\u7e41\uff0c\u800c\u6839\u636e\u8d28\u91cf\u5bf9\u8bd5\u9898\u8fdb\u884c\u7b5b\u9009\u7684\u7b97\u6cd5\u53ef\u4ee5\u5927\u91cf\u7684\u8282\u7ea6\u4eba\u5de5\u548c\u65f6\u95f4\u3002\u4ee5\u4e0b\u4e3a\u4e00\u5957\u5168\u6d41\u7a0b\u7684\u7b80\u6613\u7248\u7684\u8bd5\u9898\u7b5b\u9009\u7b97\u6cd5\uff0c\u4ece\u6570\u636e\u6e05\u6d17\u5230\u6570\u636e\u5206\u6790\u518d\u5230\u6570\u636e\u7b5b\u9009\u3002\u901a\u8fc7R\u8bed\u8a00\u8fdb\u884c\u5206\u6790\uff0c\u901a\u8fc7Java\u5b9e\u73b0\u7b5b\u9009\u3002<\/h3>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">##dealData = function(filename){}\u662f\u7528\u4e8e\u8fde\u63a5Jave\u6240\u6784\u5efa\u7684function\uff0c\u82e5\u4e0d\u9700\u8981\uff0c\u53bb\u6389\u5373\u53ef###<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">dealData = function(filename) {<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ###################################<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ##\u8f7d\u5165\u9700\u8981\u7684R\u5305##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 library(\"Rserve\")\u00a0 #\u7528\u4e8e\u8fde\u63a5R\u4e0eJava<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 library(\"TAM\")\u00a0 #\u7528\u4e8e\u8fdb\u884cIRT\u5206\u6790<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 library(readxl)\u00a0 #\u7528\u4e8e\u8bfb\u53d6excel\u6570\u636e\u8868<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ####################################<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 setwd(\"C:\/...\")\u00a0 ##\u8bbe\u7f6e\u6570\u636e\u6240\u5728\u7684\u76ee\u5f55##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 testdata = read_excel(\"data.xlsx\", col_names = TRUE)\u00a0 ##\u8bfb\u53d6\u6570\u636e##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 data = testdata<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 #######\u6e05\u6d17\u6570\u636e#######<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 #\u5220\u9664\u5927\u91cf\u4f5c\u7b54\u90fd\u5f970\u5206\u7684\u6d4b\u8bd5\u8005\u6570\u636e##<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ##\u6784\u5efafunction\uff0c\u67e5\u627e0\u591a\u4e8e\u6570\u636e\u884c\u957f\u768480%\u7684\u6570\u636e##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ff =\u00a0 function(row) (sum(row==0) &gt; ncol(data)*0.8)\u00a0<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ##\u5220\u9664\u4f5c\u7b54\u5f97\u52300\u5206\u6570\u91cf\u591a\u4e8e\u884c\u957f80%\u7684\u6d4b\u8bd5\u8005\u4f5c\u7b54#####<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 data = data[!apply(data, 1,ff),]\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 #\u5220\u9664\u5b58\u5728\u5927\u91cf\u7a7a\u503c\u7684\u884c\u548c\u5217<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 B = B[!apply(B, 1, function(x){all(is.na(x))}),]\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 B = B[,!apply(B, 2, function(x){all(is.na(x))})]\u00a0<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ##\u5220\u9664NA\u5927\u4e8e60%\u7684\u884c\u6570\u636e##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 B = B[!apply(B, 1, function(x){sum(is.na(x))&gt;=length(x)*0.6}),]\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ##\u5220\u9664\u6ee1\u5206\u62160\u5206\u7684\u884c\u6570\u636e##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 B = B[!apply(B, 1, function(x){max(table(as.numeric(x)))&gt;=length(x)}),]\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ##\u5220\u9664NA\u5927\u4e8e60%\u7684\u5217\u6570\u636e##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 B = B[,!apply(B, 2, function(x){sum(is.na(x))&gt;=length(x)*0.6})]<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ##\u5220\u9664\u6ee1\u5206\u62160\u5206\u7684\u5217\u6570\u636e##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 B = B[,!apply(B, 2, function(x){max(table(as.numeric(x)))&gt;=length(x)})]<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ####\u5c06\u6570\u636e\u8f6c\u4e3a\u65e0\u95f4\u9694\u987a\u5e8f\u6570\u636e###<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ####\u4f8b\u5982\uff1a\u67d0\u9053\u9898\u7684\u4f5c\u7b54\u4ec5\u67090\u548c2\uff0c\u8f6c\u5316\u540e\uff0c\u53d8\u6210\u67090\u30011####<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ####\u82e5\u67d0\u9053\u9898\u7684\u4f5c\u7b54\u4ec5\u67090\u30012\u30013\uff0c\u8f6c\u5316\u540e\uff0c\u53d8\u62100\u30011\u30012########<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 x = list()<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 for(j in 1:ncol(B)){<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 \u00a0 x[[j]] = sort(unlist(unique(B[,j])))<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 \u00a0 for(i in 1:length(x[[j]])){<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 \u00a0 \u00a0 B[,j][which(B[,j]==x[[j]][i]),]=i-1<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 \u00a0 }<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 }<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ##\u8bbe\u7f6e\u8f93\u51fa\u5c0f\u6570\u70b9\u4fdd\u75593\u4f4d##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 options(digits=3)<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 #########\u5c06\u9009\u62e9\u9898\u5404\u7c7b\u9009\u9879\u8fdb\u884c\u8ba1\u5206\u8f6c\u5316#########<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 #\u57281,2,3\u5217\u76843\u9053\u9898\u7684\u7b54\u6848\u4e3aA\uff0c\u51e1\u4f5c\u7b54A\u7684\u8f6c\u5316\u4e3a1\uff0c\u5176\u4ed6\u8f6c\u5316\u4e3a0#<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 #\u57284,5,6\u5217\u76843\u9053\u9898\u7684\u7b54\u6848\u4e3aB\uff0c\u51e1\u4f5c\u7b54B\u7684\u8f6c\u5316\u4e3a1\uff0c\u5176\u4ed6\u8f6c\u5316\u4e3a0#<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 #\u57287,8,9\u5217\u76843\u9053\u9898\u7684\u7b54\u6848\u4e3aC\uff0c\u51e1\u4f5c\u7b54C\u7684\u8f6c\u5316\u4e3a1\uff0c\u5176\u4ed6\u8f6c\u5316\u4e3a0#<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 #\u572810,11,12\u5217\u76843\u9053\u9898\u7684\u7b54\u6848\u4e3aD\uff0c\u51e1\u4f5c\u7b54D\u7684\u8f6c\u5316\u4e3a1\uff0c\u5176\u4ed6\u8f6c\u5316\u4e3a0#<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 B[,c(1,2,3)] = (B[,c(1,2,3)]==\"A\")*1\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 B[,c(4,5,6)] = (B[,c(4,5,6)]==\"B\")*1\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 B[,c(7,8,9)] = (B[,c(7,8,9)]==\"C\")*1<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 B[,c(10,11,12)] = (B[,c(10,11,12)]==\"D\")*1<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ###\u5982\u679c\u6ca1\u6709\u8ba1\u5206\u8f6c\u5316\uff0c\u76f4\u63a5\u8df3\u5230\u6b64\u6b65\u9aa4#########<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 resp = B<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ###########\u6570\u636e\u5206\u6790\u8fc7\u7a0b######################<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 mod1 = TAM::tam.mml(resp,irtmodel=\"PCM\")\u00a0 ###\u4f7f\u7528PCM\u8fdb\u884c\u5206\u6790##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 #summary(mod1)<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 IRTdiff = mod1$item[,c(1,2,4)]\u00a0 ##\u63d0\u53d6IRT\u96be\u5ea6##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 Abil = tam.wle(mod1)\u00a0 ##\u6c42\u80fd\u529b\u503c##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 PersonAbility = Abil$theta\u00a0 \u00a0#\u63d0\u53d6\u4f5c\u7b54\u8005\u80fd\u529b##\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 Fit = msq.itemfit(mod1)\u00a0 \u00a0##\u6c42\u9898\u76ee\u62df\u5408\u503c##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 Fit = Fit$itemfit[,c(1,3,6)]\u00a0 \u00a0 \u00a0 ##\u63d0\u53d6\u9898\u76ee\u62df\u5408\u503c##<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 cttmean = mod1$item[,3] ###\u63d0\u53d6\u6bcf\u9053\u9898\u4f5c\u7b54\u7684\u5e73\u5747\u503c###<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 maxcol = apply(resp,2,max,na.rm = TRUE) ##\u6b64\u8bed\u53e5\u5047\u8bbe\u6bcf\u9053\u9898\u7684\u6240\u6709\u4f5c\u7b54\u4e2d\u81f3\u5c11\u6709\u4e00\u4e2a\u4f5c\u7b54\u4e3a\u6ee1\u5206\uff0c\u82e5\u67d0\u9898\u7684\u4f5c\u7b54\u6ca1\u6709\u6700\u9ad8\u5206\u65f6\uff0c\u9700\u8981\u91cd\u65b0\u8bbe\u7f6e####\u91cd\u65b0\u8bbe\u7f6e: maxcol = c(\u6bcf\u9898\u6700\u9ad8\u5206)########<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 CTTdiff = cttmean\/maxcol ###\u6c42CTT\u96be\u5ea6###<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 Discrim = cor(resp,PersonAbility,use=\"complete.ob\")##\u6c42\u533a\u5206\u5ea6\uff0c\u5373\u80fd\u529b\u503c\u4e0e\u4f5c\u7b54\u76f8\u5173##<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 alldata = cbind(IRTdiff,CTTdiff,Discrim,Fit[,-1]) ###\u5c06\u6240\u6709\u6570\u636e\u7ec4\u6210\u4e00\u4e2a\u6570\u7ec4###<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 colnames(alldata) = c(\"Item\",\"N\",\"IRTdiff\",\"CTTdiff\",\"Discrim\", \"Outfit\", \"Infit\") ###\u7ed9\u6570\u7ec4\u6bcf\u5217\u547d\u540d####<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ########\u6839\u636e\u4e0a\u8ff0\u6570\u636e\u4e2d\u7684\u5404\u9879\u53c2\u6570\u503c\u8bbe\u5b9a\u9898\u76ee\u7b5b\u9009\u6761\u4ef6#####################<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ##\u8bbe\u5b9a\u6761\u4ef6\u4e3a\uff1a\u4f5c\u7b54\u4eba\u6570\u8d85\u8fc7100\u7684\u9898\u76ee\u4e14\u9898\u91cf\u8d85\u8fc730\uff0c\u533a\u5206\u5ea6\u5927\u4e8e0.5\uff0c\u62df\u5408\u503c\u57280.65~1.2\u95f4##<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 condition = ifelse(alldata$N &gt;= 100 &amp; length(rownames(alldata)) &gt;= 30<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&amp; alldata$Discrim &gt;= 0.5\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&amp; alldata$Outfit &lt;= 1.2 &amp; alldata$Outfit &gt;= 0.65<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&amp; alldata$Infit &lt;= 1.2 &amp; alldata$Infit &gt;= 0.65<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0,1,0)<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ######\u5c06\u7b5b\u9009\u51fa\u6765\u7684\u9898\u76ee\u6309\u7167CTT\u96be\u5ea6\u8fdb\u884c\u9ad8\u3001\u4e2d\u3001\u4f4e\u5206\u7ec4###########<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 easycon = ifelse(alldata$CTTdiff &gt;= 0.75&amp; alldata$CTTdiff &lt; 0.9, 1,0)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 medcon = ifelse(alldata$CTTdiff &gt;= 0.5 &amp; alldata$CTTdiff &lt; 0.75,1,0)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 hardcon = ifelse(alldata$CTTdiff &gt;= 0.15 &amp; alldata$CTTdiff &lt; 0.5,1,0)\u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 condata = cbind(alldata,condition,easycon,medcon,hardcon)<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 condata<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 ###########\u63d0\u53d6\u5404\u79cd\u96be\u5ea6\u7c7b\u578b\u7684\u9898\u53f7######################<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 easyItem = rownames(condata[which(condata$condition == 1 &amp; condata$easycon == 1),])<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 mediumItem = rownames(condata[which(condata$condition == 1 &amp; condata$medcon == 1),])<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 hardItem = rownames(condata[which(condata$condition == 1 &amp; condata$hardcon == 1),])<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 e = list(easyItem = easyItem, mediumItem = mediumItem, hardItem = hardItem)<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0 return (e)<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">}<\/span><\/code><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4eca\uff0c\u5728\u7ebf\u6d4b\u8bd5\u8d8a\u6765\u8d8a\u591a\uff0c\u5728\u7ebf\u9898\u5e93\u7684\u4f7f\u7528\u4e5f\u66f4\u52a0\u9891\u7e41\uff0c\u800c\u6839\u636e\u8d28\u91cf\u5bf9\u8bd5\u9898\u8fdb\u884c\u7b5b\u9009\u7684\u7b97\u6cd5\u53ef\u4ee5\u5927\u91cf\u7684\u8282\u7ea6\u4eba\u5de5\u548c\u65f6\u95f4\u3002\u4ee5\u4e0b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.beneplot.com\/?p=595\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u9898\u76ee\u7b5b\u9009\u7b97\u6cd5 - R\u8bed\u8a00 - Beneplot\" \/>\n<meta property=\"og:description\" content=\"\u5982\u4eca\uff0c\u5728\u7ebf\u6d4b\u8bd5\u8d8a\u6765\u8d8a\u591a\uff0c\u5728\u7ebf\u9898\u5e93\u7684\u4f7f\u7528\u4e5f\u66f4\u52a0\u9891\u7e41\uff0c\u800c\u6839\u636e\u8d28\u91cf\u5bf9\u8bd5\u9898\u8fdb\u884c\u7b5b\u9009\u7684\u7b97\u6cd5\u53ef\u4ee5\u5927\u91cf\u7684\u8282\u7ea6\u4eba\u5de5\u548c\u65f6\u95f4\u3002\u4ee5\u4e0b [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.beneplot.com\/?p=595\" \/>\n<meta property=\"og:site_name\" content=\"Beneplot\" \/>\n<meta property=\"article:published_time\" content=\"2017-07-04T02:20:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-07-23T07:15:41+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.beneplot.com\/#website\",\"url\":\"https:\/\/www.beneplot.com\/\",\"name\":\"Beneplot\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.beneplot.com\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-CN\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.beneplot.com\/?p=595#webpage\",\"url\":\"https:\/\/www.beneplot.com\/?p=595\",\"name\":\"\\u9898\\u76ee\\u7b5b\\u9009\\u7b97\\u6cd5 - R\\u8bed\\u8a00 - Beneplot\",\"isPartOf\":{\"@id\":\"https:\/\/www.beneplot.com\/#website\"},\"datePublished\":\"2017-07-04T02:20:42+00:00\",\"dateModified\":\"2020-07-23T07:15:41+00:00\",\"author\":{\"@id\":\"https:\/\/www.beneplot.com\/#\/schema\/person\/ea14f85ae789ceaaa712ceee1dd1f95b\"},\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.beneplot.com\/?p=595\"]}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/www.beneplot.com\/#\/schema\/person\/ea14f85ae789ceaaa712ceee1dd1f95b\",\"name\":\"beneplot\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.beneplot.com\/#personlogo\",\"inLanguage\":\"zh-CN\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/15d96ce801cfddbd59ef2b0d986cd9b1?s=96&r=g\",\"caption\":\"beneplot\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/posts\/595"}],"collection":[{"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=595"}],"version-history":[{"count":13,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/posts\/595\/revisions"}],"predecessor-version":[{"id":758,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/posts\/595\/revisions\/758"}],"wp:attachment":[{"href":"https:\/\/www.beneplot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}