问题
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