【问题标题】:Error in abs(x) : non-numeric argument to mathematical function R langabs(x) 中的错误:数学函数 R lang 的非数字参数
【发布时间】:2020-08-12 17:25:41
【问题描述】:

R 中的新手,有问题但不明白到底有什么问题。单独的代码工作正常。我一起收到这个错误

 Error in abs(x) : non-numeric argument to mathematical function
In addition: Warning message:
Removed 1 row(s) containing missing values (geom_path). 

代码在这里

p + ggtitle("BTC Price Prformance") + 
  theme(plot.title = element_text(color="#002D7D", size=14, face="bold", hjust = 0.5)) + 
  theme(plot.title = element_text(color="#002D7D", size=14, face="bold", hjust = 0.5)) + 
  scale_x_continuous(limits = c(1,nrow(mResult)), expand = c(0, 0), breaks = as.numeric(mXLabels[,1]), labels = mXLabels[,2])  + 
  scale_y_continuous(limits = c(0,max( excelSheet$High[excelSheet$High!=max(excelSheet$High)] )), expand = c(0, 0), breaks=c(0, 2500, 5000, 7500, 10000, 12500, 15000, 17500, 20000)) + 
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

【问题讨论】:

  • 能否请您显示完整的代码和数据示例?
  • 您的数据是否缺少观察结果,即 max 是否可以重新调整 NA

标签: r


【解决方案1】:

错误消息说您缺少值。试试

your_variable <- na.omit(your_variable)

得到一个无 na 的向量。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多