r - 错误消息“配对中的错误 || !is.null(y) : 'x || y' 中的 'x' 类型无效”
问题描述
请帮助我了解为什么会出现该错误以及解决该错误的任何方法。谢谢!
a<- filter(combine2, NEIGHBORHOOD_NAME=="ASTORIA", YEAR_BUILT>="2009")$SALE_PRICE
b<- filter(combine2, NEIGHBORHOOD_NAME=="CORONA", YEAR_BUILT>="2009")$SALE_PRICE
t.test(a,b, alternative = "greater", mu=0, paired= "false", conf.level = .95)
解决方案
看起来错误是基于取逻辑值的t.test
地方,即而不是字符串“false”paired
TRUE/FALSE
t.test(a,b, alternative = "greater", mu=0, paired= FALSE, conf.level = .95)
即错误是可重现的
t.test(1:10, y = c(7:20), paired = "false")
配对错误 || !is.null(y) : 'x || 中的'x' 类型无效 你'
相反,它会是
t.test(1:10, y = c(7:20))
# Welch Two Sample t-test
#data: 1:10 and c(7:20)
#t = -5.4349, df = 21.982, p-value = 1.855e-05
#alternative hypothesis: true difference in means is not equal to 0
#95 percent confidence interval:
# -11.052802 -4.947198
#sample estimates:
#mean of x mean of y
# 5.5 13.5