使用NA数据绘制条件颜色

时间:2016-07-13 19:59:00

标签: r plot na

我在R中有一个数据框,它有2个数字字段,其中1个字段可以包含NA值。

我想绘制第一个字段并在第二个字段为NA时关闭col。

CurrentBackLog = as.data.frame(list(DaysSinceCreted = c(34,50,22,6),DaysSinceReady = c(NA,10,22,NA)))

这只显示DaysSinceReady不是NA的项目......

plot(CurrentBackLog$DaysSinceCreated,
     main = 'Days Since Created by Ticket',
     ylab = 'Days Since Created',
     pch = 15,
     col = ifelse(CurrentBackLog$DaysSinceReady>1,'red','blue')
)

0 个答案:

没有答案