0
내 데이터 집합은 here을 참조 할 수 있습니다. 요지로, 나는 평균 및 신뢰 구간을 그릴 필요가있는 fitted이라는 열을 가지고 있습니다.신뢰 구간을 코딩 할 때 dplyr을 사용하여 열의 길이를 구하는 방법 R
내 ggplot 여기
data.melt$time = factor(data.melt$time, levels=paste("t", seq(0, 10), sep=""))
에 대한 기능을 dplyr 사용하여 신뢰 구간에 대한 코드에 노력하고는 장착
가summary_dat = data.melt$time %>%
group_by(resource, fertilizer, time) %>%
summarise(mean_predict=mean(fitted),
sd_predict = sd(fitted),
n_predict = n(fitted)) %>%
mutate(se = sd_predict/sqrt(n_predict),
lower_ci = mean_predict - qt(1 - (0.05/2), n_predict - 1) * se_predict,
upper_ci = mean_predict + qt(1 - (0.05/2), n_predict - 1) * se_predict)
그러나, R은 저를 n으로 n_predict 코드를 허용하지 않는 코드 (이다). 나도 길이 (맞았다) 그러나 운 없음을 시험해 보았다. 어떤 아이디어?
'length()'를 사용하고'n()'을 사용하지 않으면 접근법이 작동하지만 코드에 작은 오타가 있습니다. 첫 번째 줄은'data.melt $ time'이 아니라'data.melt'라는 전체 데이터 프레임으로 시작해야합니다. 문제의 열은'fitted'이 아닌'predict'라고하며, 표준 오류는 두 개의 다른 이름,'se'와'se_predict'. – qdread