R中的数据对比

时间:2019-02-28 15:05:55

标签: r

我正在尝试形成对比。我使用了以下脚本

contrast <- makeContrasts(tam=("GSM151013-GSM150949"), ("GSM151014-GSM150950"), ("GSM151016-GSM150951"), ("GSM151019-GSM150953"), ("GSM151025-GSM150954"),levels=design) 

“设计”如下

      tam              tamless

GSM151013   0                   1

GSM151014   0                   1

GSM151016   0                   1

GSM151019   0                   1

GSM151025   0                   1

GSM150949   1                   0

GSM150950   1                   0

GSM150951   1                   0

GSM150953   1                   0

GSM150954   1                   0

attr(,"assign")
[1] 1 1
attr(,"contrasts")
attr(,"contrasts")$f
[1] "contr.treatment"

运行代码时,出现以下错误:

Error in eval(ej, envir = levelsenv) : object 'GSM151013' not found

任何帮助将不胜感激

1 个答案:

答案 0 :(得分:0)

您可能有语法问题。

尝试一下:

design <- c('GSM151013', 'GSM150949', 'GSM151014', 'GSM150950', 
            'GSM151016', 'GSM150951', 'GSM151019', 'GSM150953', 
            'GSM151025', 'GSM150954')

makeContrasts(GSM151013-GSM150949, GSM151014-GSM150950, GSM151016-GSM150951, 
              GSM151019-GSM150953, GSM151025-GSM150954, levels=design)