如何组合课程

时间:2016-12-14 19:58:51

标签: r class indicator

我正在尝试组合课程,并且无法弄清楚如何。

我正在使用大型数据集

library("ALL"); data(ALL, package = "ALL");

并正常加载指标如下:

 allB <- ALL[,which(ALL$BT %in% c("B","B1","B2", "B3","B4"))]

并将其分为5,但我想将B3和B4结合起来

我尝试了一些不同的东西,

b1 <- ALL[,which(ALL$BT %in% c("B1"))] #select patients
b2 <- ALL[,which(ALL$BT %in% c("B2"))]
b34 <- ALL[,which(ALL$BT %in% c("B3","B4"))]
w <- c(b1,b2,b34)

allb <- ALL[,which(ALL$BT %in% c("B1","B2", c("B3","B4")))] 

allb <- ALL[,which(ALL$BT %in% c("B1","B2","B3|B4"))] 

但他们都没有工作

数据集信息:

ALL$BT
[1] B2 B2 B4 B1 B2 B1 B1 B1 B2 B2 B3 B3 B3 B2 B3 B  B2 B3 B2 B3 B2 B2 B2 B1 B1 B2 B1 B2 B1 B2 B  B  B2 B2 B2 B1 B2 B2 B2 B2 B2 B4 B4
[44] B2 B2 B2 B4 B2 B1 B2 B2 B3 B4 B3 B3 B3 B4 B3 B3 B1 B1 B1 B1 B3 B3 B3 B3 B3 B3 B3 B3 B1 B3 B1 B4 B2 B2 B1 B3 B4 B4 B2 B2 B3 B4 B4
[87] B4 B1 B2 B2 B2 B1 B2 B  B  T  T3 T2 T2 T3 T2 T  T4 T2 T3 T3 T  T2 T3 T2 T2 T2 T1 T4 T  T2 T3 T2 T2 T2 T2 T3 T3 T3 T2 T3 T2 T 
Levels: B B1 B2 B3 B4 T T1 T2 T3 T4

allB$BT
 [1] B2 B2 B4 B1 B2 B1 B1 B1 B2 B2 B3 B3 B3 B2 B3 B  B2 B3 B2 B3 B2 B2 B2 B1 B1 B2 B1 B2 B1 B2 B  B  B2 B2 B2 B1 B2 B2 B2 B2 B2 B4 B4 B2
[45] B2 B2 B4 B2 B1 B2 B2 B3 B4 B3 B3 B3 B4 B3 B3 B1 B1 B1 B1 B3 B3 B3 B3 B3 B3 B3 B3 B1 B3 B1 B4 B2 B2 B1 B3 B4 B4 B2 B2 B3 B4 B4 B4 B1
[89] B2 B2 B2 B1 B2 B  B 
Levels: B B1 B2 B3 B4 T T1 T2 T3 T4

ALL
ExpressionSet (storageMode: lockedEnvironment)
assayData: 12625 features, 128 samples 
  element names: exprs 

1 个答案:

答案 0 :(得分:0)

我一定是说错了,我想重命名等级

levels(allB$BT)[levels(allB$BT)=="B3"] <- "B34"
levels(allB$BT)[levels(allB$BT)=="B4"] <- "B34"

曾为

allB$BT
 [1] B2  B2  B34 B1  B2  B1  B1  B1  B2  B2  B34 B34 B34 B2  B34 B2  B34 B2  B34 B2  B2  B2  B1  B1  B2  B1  B2  B1  B2  B2  B2  B2  B1 
[34] B2  B2  B2  B2  B2  B34 B34 B2  B2  B2  B34 B2  B1  B2  B2  B34 B34 B34 B34 B34 B34 B34 B34 B1  B1  B1  B1  B34 B34 B34 B34 B34 B34
[67] B34 B34 B1  B34 B1  B34 B2  B2  B1  B34 B34 B34 B2  B2  B34 B34 B34 B34 B1  B2  B2  B2  B1  B2 
Levels: B B1 B2 B34 T T1 T2 T3 T4