R 在绘图图表的X轴中使用NAs显示值

R 在绘图图表的X轴中使用NAs显示值,r,plotly,R,Plotly,如何在y列中使用NAs在y条形图中显示x值 library(plotly) fig <- plot_ly( x = c("giraffes", "orangutans", "monkeys"), y = c(20, 14, NA), name = "SF Zoo", type = "bar" ) fig library(plotly) fig将y=replace_na(

如何在
y
列中使用
NAs
y
条形图中显示
x

library(plotly)

fig <- plot_ly(
  x = c("giraffes", "orangutans", "monkeys"),
  y = c(20, 14, NA),
  name = "SF Zoo",
  type = "bar"
)

fig
library(plotly)

fig将
y=replace_na(c(20,14,na),0)
为您工作我考虑过,但我想看看是否有其他方法您对na Bar的期望是什么如果没有结果,您可以发布答案我只是想了解您将如何可视化缺失的值。最好使用另一个类别来统计缺失值的数量