因子中的重复级别

时间:2017-06-28 08:03:43

标签: r

几周以来,我使用了相同的Rcode。今天早上我开始收到错误:`

  

因子Study_ID中的重复级别:Kumaravel,Gradl,Moroni。

重复级别有什么问题?
每项研究都有不同的手臂,都有自己的排。我该怎么办呢?

我的保管箱上的数据集:https://www.dropbox.com/s/j1urqzr99bt76ip/Basics%20excel%20file%20complication%20and%20reoperation%20rate.xlsx?dl=0

library(meta)
library(stargazer)
library(foreign)

All <-read.spss("C:\\Users\\313635aa.STUDENT\\Desktop\\Meta-Analyse Complications.sav",to.data.frame = T, use.value.labels = T)
All <- na.omit(All)


#outcomes
Complications <- All[which(All[,"Event_Type"] == "Complications"),]
Re_operation <- All[which(All[,"Event_Type"] == "Reoperations"),]

#treatment type
EF <- All[which(All[,"Treatment"] == "EF"),]
IMN <- All[which(All[,"Treatment"] == "IMN"),]
pc <- All[which(All[,"Treatment"] == "PC"),]
KW <- All[which(All[,"Treatment"] == "KW"),]
VPO <- All[which(All[,"Treatment"] == "VPO"),]

#combined ones
EF_C <- EF[which(EF[,"Event_Type"] == "Complications"),]
EF_R <- EF[which(EF[,"Event_Type"] == "Reoperations"),]

IMN_C <- IMN[which(IMN[,"Event_Type"] == "Complications"),]
IMN_R <- IMN[which(IMN[,"Event_Type"] == "Reoperations"),]

pc_C <- pc[which(pc[,"Event_Type"] == "Complications"),]
pc_R <- pc[which(pc[,"Event_Type"] == "Reoperations"),]

KW_C <- KW[which(KW[,"Event_Type"] == "Complications"),]
KW_R <- KW[which(KW[,"Event_Type"] == "Reoperations"),]

VPO_C <- VPO[which(VPO[,"Event_Type"] == "Complications"),]
VPO_R <- VPO[which(VPO[,"Event_Type"] == "Reoperations"),]

#Pooling

Output <- function(x, y, k.min=10){
file <- metaprop(Events_n, N, Study_ID, data = x)

forest.meta(file, studlab = T, pooled.totals = T, bysort = F)

dev.copy2pdf(file=y, width = 11.69, height = 8.27)
print(file)
    }

数据集的一部分:

Study| Event Type| Treatment| Number of Events (n)| N| n/N|
Kumaravel| Complications| EF| 3| 23| 0,1304348|
Franck| Complications| EF| 2| 20| 0,1|
Schonnemann| Complications| EF| 8| 30| 0,2666667|
Aita| Complications| EF| 1| 16| 0,0625|
Hove| Complications| EF| 31| 39| 0,7948718|
Andersen| Complications| EF| 26| 75| 0,3466667|
Krughaug| Complications| EF| 22| 75| 0,2933333|
Moroni| Complications| EF| 0| 20| 0|
Plate| Complications| IMN| 3| 30| 0,1|
Chappuis| Complications| IMN| 4| 16| 0,25|
Gradl| Complications| IMN| 12| 66| 0,1818182|
Schonnemann| Complications| IMN| 6| 31| 0,1935484|
Aita| Complications| IMN| 1| 16| 0,0625|
Dremstrop| Complications| IMN| 17| 44| 0,3863636|
Wong| Complications| PC| 1| 30| 0,0333333|
Kumaravel| Complications| PC| 4| 25| 0,16|

1 个答案:

答案 0 :(得分:1)

这是您的问题的解决方案 我开始加载您的Excel数据集,然后定义 $res=@$auth->login('login','pass'); if ($res===TRUE) { // login successful } elseif ($res===FALSE) { // wrong credentials } else { // LDAP connection failure } 数据集:

Outcomes

然后,我按如下方式修改您的library(meta) library(readxl) All <- read_excel("Basics excel file complication and reoperation rate.xlsx", sheet=1) names(All) <- c("Study_ID","Event_Type","Treatment","Events_n","N","nN") # Outcomes Complications <- subset(All, Event_Type=="Complications") 函数:

Output

现在我将Output <- function(x, file_name) { mtpr <- metaprop(Events_n, N, Study_ID, data = x) forest.meta(mtpr, studlab = TRUE, pooled.totals = TRUE, bysort = FALSE) dev.copy2pdf(file=file_name, width = 11.69, height = 8.27) print(mtpr) } Output数据集一起使用:

Complications

输出结果为:

enter image description here