Plot conditional color with NA data

蹲街弑〆低调 提交于 2021-02-11 12:21:59

问题


I have a data frame in R that has 2 numeric fields, 1 of these fields can contain NA values.

I want to plot the first field and base the col off if the second field is NA or not.

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

This only shows the items where DaysSinceReady is NOT NA...

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

来源:https://stackoverflow.com/questions/38360660/plot-conditional-color-with-na-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!