我有一个数据集,我试图找到rand索引与另一个数据集进行比较。其中一组如下所示。第二组与此非常相似。我一直在尝试使用classAgreement()
函数来获取rand索引,但是我不知道如何将我拥有的数据转换为classAgreemeent()
可以使用的数据。如果我能得到一个比较每个数据的表格,我认为它会有所帮助,但我感到迷茫。
-3 6 2
-2 7 2
-5 4 2
-4 7 2
12 10 3
11 9 3
14 11 3
13 12 3
14 18 1
15 19 1
13 20 1
15 16 1
16 18 1
17 17 1
2 10 2
14 9 3
17 6 3
-1 17 2
17 9 3
0 12 2
如果运行table(mydata),则每个V3(1,2或3)的值都会得到三个表。
, , V3 = 1
V2
V1 4 6 7 9 10 11 12 16 17 18 19 20
-5 0 0 0 0 0 0 0 0 0 0 0 0
-4 0 0 0 0 0 0 0 0 0 0 0 0
-3 0 0 0 0 0 0 0 0 0 0 0 0
-2 0 0 0 0 0 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0 0 0 0
11 0 0 0 0 0 0 0 0 0 0 0 0
12 0 0 0 0 0 0 0 0 0 0 0 0
13 0 0 0 0 0 0 0 0 0 0 0 1
14 0 0 0 0 0 0 0 0 0 1 0 0
15 0 0 0 0 0 0 0 1 0 0 1 0
16 0 0 0 0 0 0 0 0 0 1 0 0
17 0 0 0 0 0 0 0 0 1 0 0 0
, , V3 = 2
V2
V1 4 6 7 9 10 11 12 16 17 18 19 20
-5 1 0 0 0 0 0 0 0 0 0 0 0
-4 0 0 1 0 0 0 0 0 0 0 0 0
-3 0 1 0 0 0 0 0 0 0 0 0 0
-2 0 0 1 0 0 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0
2 0 0 0 0 1 0 0 0 0 0 0 0
11 0 0 0 0 0 0 0 0 0 0 0 0
12 0 0 0 0 0 0 0 0 0 0 0 0
13 0 0 0 0 0 0 0 0 0 0 0 0
14 0 0 0 0 0 0 0 0 0 0 0 0
15 0 0 0 0 0 0 0 0 0 0 0 0
16 0 0 0 0 0 0 0 0 0 0 0 0
17 0 0 0 0 0 0 0 0 0 0 0 0
, , V3 = 3
V2
V1 4 6 7 9 10 11 12 16 17 18 19 20
-5 0 0 0 0 0 0 0 0 0 0 0 0
-4 0 0 0 0 0 0 0 0 0 0 0 0
-3 0 0 0 0 0 0 0 0 0 0 0 0
-2 0 0 0 0 0 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0 0 0 0
11 0 0 0 1 0 0 0 0 0 0 0 0
12 0 0 0 0 1 0 0 0 0 0 0 0
13 0 0 0 0 0 0 1 0 0 0 0 0
14 0 0 0 1 0 1 0 0 0 0 0 0
15 0 0 0 0 0 0 0 0 0 0 0 0
16 0 0 0 0 0 0 0 0 0 0 0 0
17 0 1 0 1 0 0 0 0 0 0 0 0
我如何处理其中一个生成的表格?
答案 0 :(得分:2)
您可以使用[]
选择数据并为要选择的表提供第三个位置,例如,选择第二个表格:
table(mydata)[,,2]
V2
V1 4 6 7 9 10 11 12 16 17 18 19 20
-5 1 0 0 0 0 0 0 0 0 0 0 0
-4 0 0 1 0 0 0 0 0 0 0 0 0
-3 0 1 0 0 0 0 0 0 0 0 0 0
-2 0 0 1 0 0 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0
2 0 0 0 0 1 0 0 0 0 0 0 0
11 0 0 0 0 0 0 0 0 0 0 0 0
12 0 0 0 0 0 0 0 0 0 0 0 0
13 0 0 0 0 0 0 0 0 0 0 0 0
14 0 0 0 0 0 0 0 0 0 0 0 0
15 0 0 0 0 0 0 0 0 0 0 0 0
16 0 0 0 0 0 0 0 0 0 0 0 0
17 0 0 0 0 0 0 0 0 0 0 0 0