从metafor包打印influence()结果后,如何获取每个条目的行号?

时间:2016-06-08 10:54:34

标签: r

我正在进行荟萃分析。我正在使用influence()命令进行异常值检测。

所以我做的是以下内容:

outlier1 <- influence(result)
print(outlier1)

这给了我250条条目,表明是否必须排除研究。然后我必须通过指示行删除异常值研究。事情就是这样:我有250项研究,而且我不想手动计算行数,以便知道要排除哪些研究。

以下是结果:

Study Indicator_1 Indicator_N Outlier?
------------------------------------

(250 entries)

现在我想知道如何改变打印结果,使其看起来像:

Number Study Indicator_1 Indicator_N Outlier?
--------------------------------------------

计数最好从1开始。

以下是创建可重现示例所需的数据和代码序列:

数据:http://www.filedropper.com/metadaten

代码序列:

install.packages("xlsx")
install.packages("metafor")
library(xlsx)
library(metafor)

input <-read.xlsx("C:/Users/feal/Documents/BA_MA/Data/01. ID FP/meta_daten.xlsx", sheetName="input")

## View(input)

result <-rma(yi=zcor, vi=var, data=input, 
   measure="GEN", method="REML", level=95,
   slab=paste(author, pub_date, sep=", "))

print(result)

outlier1 <- influence(result)
print(outlier1)

之后我得到以下结果,右边的一颗星表示必须删除异常值。

删除函数,例如:

input_out1 <-input[-19,]
print(input_out1)

我只希望每列都有一个条目号。 或者每个要删除的条目,右边都有一个星标。

1 个答案:

答案 0 :(得分:0)

好的,我自己拿到了。

如果您能够转换结果以便可以使用<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:bottom="1dp" android:left="1dp" android:right="1dp" android:top="2dp"> <shape android:shape="rectangle" > <stroke android:width="2dp" android:color="#009bdb" /> <solid android:color="#00FFFFFF" /> <padding android:left="0dp" android:right="0dp" android:top="2dp" android:bottom="0dp" /> </shape> </item> </layer-list> <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tableLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/customborder" android:layout_margin="10dp" > <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="20dp" android:layout_marginTop="20dp" android:layout_marginLeft="20dp" android:orientation="horizontal" android:background="#cbe5f8" android:padding="5dip" > <TextView android:id="@+id/textView1" android:text="Order Id:" android:textColor="@color/textcolor"/> <TextView android:id="@+id/textView2" android:text="Placed Date:" android:gravity="right" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:padding="15dip"></TextView> </TableRow> <TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="20dp" android:layout_marginTop="20dp" android:layout_marginLeft="20dp" android:padding="5dip" android:orientation="vertical" android:background="@drawable/bdr_top_bottom" > <TextView android:id="@+id/textView3" android:text="Address:" /> </TableRow> <TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="20dp" android:layout_marginTop="20dp" android:layout_marginLeft="20dp" android:padding="5dip" android:orientation="vertical" android:background="@drawable/bdr_top_bottom"> <TextView android:id="@+id/textView4" android:text="Placed Order:" /> <TextView android:id="@+id/placedorder" android:layout_height="wrap_content" android:layout_marginLeft="20dip" android:layout_marginRight="20dip" android:layout_weight="1" /> </TableRow> <TableRow android:id="@+id/tableRow4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="20dp" android:layout_marginTop="20dp" android:layout_marginLeft="20dp" android:padding="5dip" android:orientation="vertical" android:background="@drawable/bdr_top_bottom"> <TextView android:id="@+id/textView5" android:text="Service Opted: " /> <TextView android:id="@+id/serviceopted" android:layout_height="wrap_content" android:layout_marginLeft="20dip" android:layout_marginRight="20dip" android:layout_weight="1" /> </TableRow> <TableRow android:id="@+id/tableRow5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="20dp" android:layout_marginTop="20dp" android:layout_marginLeft="20dp" android:padding="5dip" android:orientation="vertical" android:background="@drawable/bdr_top_bottom"> <TextView android:id="@+id/textView6" android:text="Order Status:" /> <TextView android:id="@+id/orderstatus" android:layout_height="wrap_content" android:layout_marginLeft="20dip" android:layout_marginRight="20dip" android:layout_weight="1" /> </TableRow> <TableRow android:id="@+id/tableRow6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="20dp" android:layout_marginTop="20dp" android:layout_marginLeft="20dp" android:padding="5dip" android:orientation="vertical" android:background="@drawable/bdr_top_bottom"> <TextView android:id="@+id/textView7" android:text="Time Slot:" /> <TextView android:id="@+id/timeslot" android:layout_height="wrap_content" android:layout_marginLeft="20dip" android:layout_marginRight="20dip" android:layout_weight="1" /> </TableRow> <TableRow android:id="@+id/tableRow7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="20dp" android:layout_marginTop="20dp" android:layout_marginLeft="20dp" android:padding="5dip" android:orientation="vertical" android:background="@drawable/bdr_top_bottom"> <TextView android:id="@+id/textView8" android:text="Contact Number:" /> <TextView android:id="@+id/contactno" android:layout_height="wrap_content" android:layout_marginLeft="20dip" android:layout_marginRight="20dip" android:text="8556023080" android:layout_weight="1" /> </TableRow> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_horizontal" android:padding="6dp" android:weightSum="2"> <Button android:id="@+id/repeat" android:layout_height="wrap_content" android:layout_width="0dp" android:layout_marginTop="20dp" android:text="Repeat Order" android:layout_marginRight="20dp" android:layout_marginLeft="20dp" android:layout_marginBottom="20dp" android:textSize="20dp" android:background="#009bdb" android:textColor="#FFFFFF" android:layout_weight="1"/> </LinearLayout> </TableLayout> 功能,在RStudio的控制台窗口上方,结果将显示行号前缀。

这就是它的工作原理:

View()

此致 FEAL