楼主: 乐嘉1250
3061 1

R软件程序 [推广有奖]

  • 1关注
  • 1粉丝

高中生

7%

还不是VIP/贵宾

-

威望
0
论坛币
483 个
通用积分
0.0750
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
176 点
帖子
9
精华
0
在线时间
18 小时
注册时间
2011-11-26
最后登录
2013-12-29

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
> 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
   



谁能告诉我错在哪里了?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:R软件程序 软件程序 r软件 Interval estimate 软件程序

回帖推荐

tigerwolf 发表于2楼  查看完整内容

Looks like R finds a formula where it expects a data frame. R considers "function" = as.data.frame.default(x[], optional = TRUE)[/backcolor]is not a dataframe. thats why you got the error mssage. Verify str("function") and check it. There is online manual here, you can download it http://cran.r-project.org/doc/manuals/R-intro.pdf

本帖被以下文库推荐

沙发
tigerwolf 发表于 2013-9-23 00:29:16 |只看作者 |坛友微信交流群
Looks like R finds a formula where it expects a data frame. R considers "function" = as.data.frame.default(x[], optional = TRUE)is  not a dataframe. thats why you got the error mssage.

Verify str("function") and check it.

There is online manual here, you can download it
http://cran.r-project.org/doc/manuals/R-intro.pdf


已有 1 人评分经验 论坛币 收起 理由
胖胖小龟宝 + 10 + 10 热心帮助其他会员

总评分: 经验 + 10  论坛币 + 10   查看全部评分

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-29 01:20