【发布时间】:2014-06-02 08:32:07
【问题描述】:
我有以下两列作为我的数据框的一部分和下面的一个函数:
X
705.7553
789.2789
689.7431
559.8025
629.9365
564.9095
Y
-0.0596123270783229
0.644158691971081
-0.433854284204926
-0.365746109442603
0.566685929975495
0.398462720589891
功能:
plotM<- function( all.res, m, u ) {
plot(data$X, data$Y,
log="x", pch=20, cex=0.7,
col = ifelse( data$Y < m, "red", "black" ),
xlab = "Y", ylab = expression(Log[2]~Fold~Change))
}
函数调用:
plotM(data, .05) # plots a graph with red points when data$Y < m and black when data$Y > m
但我对以下内容感兴趣:
plotM(data, 0.05, 0.1 ) # to plot a graph with red points when data$Y < m, green when data$Y > u, and the rest colored black
有人可以帮忙吗?谢谢
【问题讨论】:
-
使用
cut而不是ifelse。