使用R为2列数据集制作Bland-Altman图

时间:2013-12-30 10:37:10

标签: r

有人可以帮我这个吗?我想使用R制作一个Bland-Altman图,对于我的数据的两列,在下面的数据中列是前臂和前臂2,但我不知道如何。

 > data_2
      Sex Forearm Height Age  Forearm2
1    Male  17    182     55      26
2    Male  18    185    103      28
3    Male  20    171     49      25
4    Male  18    176     58      25
5    Male  21    158     57      23
6  Female  21    155     43      25
7    Male  18    199    114      29
8    Male  19    176     90      25
9    Male  17    191     68      29
10   Male  23    176     52      25
11 Female  19    153     34      24
12 Female  19    160     56      26
13   Male  19    170     47      25
14   Male  22    178     62      25
15 Female  21    174     49      27
16   Male  22    162     40      24
17 Female  23    172     82      27
18 Female  19    185     99      28
19 Female  18    168     66      25
20 Female  17    155     45      24
21   Male  17    182     83      27
22 Female  17    164     42      25
23 Female  18    162     73      26
24   Male  18    185     68      28
25 Female  18    146     50      23
26 Female  23    169     47      25
27 Female  18    160     51      24
28 Female  18    170     69      25
29   Male  24    185     57      27
30   Male  24    167     46      24
31 Female  25    169     47      26
32 Female  24    164     50      25
33 Female  21    155     47     235
34 Female  24    158     37      24
35 Female  23    177     88      27
36 Female  23    155     36      24
37   Male  19    170     47      24
38 Female  21    170     48      26
39 Female  23    160     74      25
40   Male  21    180    100      26
41   Male  19    186     95      27
42   Male  21    181     65      26

这是我所做的一部分,但一无所获。我在维基百科上看到了这个,所以我试着看看我得到了什么。

> BAplot=function(data_2$forearm,data_2$forearm2){
  (data_2$forearm,data_2$forearm2,
   xlab="Mean size(mm)", 
   ylab="Difference(mm)",
   ylim=c(15,40),pch=42) 
  abline(0,0)}

Error: unexpected '$' in "BAplot=function(data_2$"

1 个答案:

答案 0 :(得分:1)

library(sos); ???altman生成:包MethComppairedDataepadeResearchMethodsmcrMethComp帮助页面警告可以弃用和删除plot命令,所以我可以抓住它:-)或使用其他包。