> interval_estimate1<-function(x, sigma=-1, alpha=0.05){
+ n<-length(x); xb<-mean(x)
+ if (sigma>=0){
+ tmp<-sigma/sqrt(n)*qnorm(1-alpha/2); df<-n
+ }
+ else{
+ tmp<-sd(x)/sqrt(n)*qt(1-alpha/2,n-1); ff<-n-1
+ }
+ data.frame(mean=xb, df=df, a=xb-tmp, b=xb+tmp)
+ }
> source("interval_estimate1.r")
> X<-c(54,67,68,78,70,66,67,70,65,69)
> interval_estimate1(X)
错误于as.data.frame.default(x[[i]], optional = TRUE) :
cannot coerce class ""function"" to a data.frame
谁能告诉我错在哪里了?