我试图在我的FWD_SummaryStats df中存储来自pwr.t.test的 n值,但每次运行代码时我都会崩溃R.确切的错误代码是&# 34; 此应用程序已请求运行时以不寻常的方式终止它... "
我不确定它为什么会发生,因为分别运行每个统计数据会产生正确的结果。任何帮助都会非常有用!
FWD_SummaryStats<-summarize(FWD1, count = n(), min = min(FWD_1_Fuel_Load, na.rm = T),
mean = mean(FWD_1_Fuel_Load, na.rm = T), median = median(FWD_1_Fuel_Load, na.rm = T),
max = max(FWD_1_Fuel_Load, na.rm = T), varience = var(FWD_1_Fuel_Load, na.rm = T),
SD = sd(FWD_1_Fuel_Load, na.rm = T),
n = pwr.t.test(d=((1.15*mean)-mean)/SD, sig.level=0.05,power = 0.95,type= "one.sample",alternative = "two.sided")$n
)
谢谢, 千电子伏
答案 0 :(得分:0)
对于遇到此问题的其他人来说,问题在于以下几行:
n = pwr.t.test(d=((1.15*mean)-mean)/SD, sig.level=0.05, power = 0.95,type="one.sample", alternative = "two.sided")$'n'
$ n必须用引号括起来形成$'n'才能存储值。
SummaryStatistics<-
summarize(FWD1, count = n(), min = min(FWD_1_Fuel_Load, na.rm = T),
mean = mean(FWD_1_Fuel_Load, na.rm = T), median = median(FWD_1_Fuel_Load, na.rm = T),
max = max(FWD_1_Fuel_Load, na.rm = T), varience = var(FWD_1_Fuel_Load, na.rm = T),
SD = sd(FWD_1_Fuel_Load, na.rm = T),
n = pwr.t.test(d=((1.15*mean)-mean)/SD, sig.level=0.05, power = 0.95,type="one.sample", alternative = "two.sided")$'n'
)
我希望这可以帮助那些陷入同样问题的人。
千电子伏