[英]How to fix 'argument is not numeric or logical: returning NA'
我讀了我的Excel數據並找到了每列的最大值,並從中計算了平均值。
library(readxl)
exp4 <- read_excel("exp4.xlsx")
View(exp4)
maxpeak <- apply(exp4, MARGIN = 2, function(x) max(x, na.rm=TRUE))
maxpeak
#the mean of all the max peaks in this experiment
mean16052019exp4 <- mean(maxpeak)
mean16052019exp4
然后,當我現在想要這些新值的平均值時,我使用另一個在BUT中讀取的excel電子表格來獲取原始最大值並減去基線值:
realmaxpeak <- (maxpeak - exp4baseline)
realmaxpeak
#trying to calculate the mean of the baseline adjusted values
View(realmaxpeak)
mean(realmaxpeak)
我明白了:警告信息:
在mean.default(realmaxpeak [0.1])中:參數不是數字或邏輯:返回NA
為什么我不能從我創建的向量(realmaxpeak)計算平均值?
TIA
你能在realmaxpeak上發布數據摘要嗎? 它無法將該字段識別為數字字段。 如果是這種情況,您將使用as.numeric()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.