楼主: xianchen321
13756 4

[问答] 请教ggplot函数找不着啊 [推广有奖]

  • 0关注
  • 0粉丝

高中生

65%

还不是VIP/贵宾

-

威望
0
论坛币
80 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
88 点
帖子
10
精华
0
在线时间
51 小时
注册时间
2015-11-1
最后登录
2025-5-24

楼主
xianchen321 发表于 2016-10-29 13:32:17 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
      请教各位大神,新手学R,写了下面做回归阶次比较的代码,系统老提示ggplot函数不存在,不知道是代码错了,还是什么问题,ggplot2也下载了啊。
    library(MASS)
attach(Boston)
dis=seq(0,1,by=0.01)
nox=sin(2*pi*dis)+rnorm(length(dis),0,0.1)
data1=data.frame(dis,nox)
set.seed(1)
index=nrow(data1)
index1=sample(index,round(0.5*index))
trainingdata=data1[index1,]
testingdata=data1[-index1,]
Performance=data.frame()
for(d in 1:15)
{
  polyfit=lm(nox~poly(dis,degree = d),data=trainingdata)
  Performance=rbind(Performance,data.frame(Degree=d,
                                           Data='Train',
                                           rmse=RMSE(trainingdata$nox,predict(polyfit))))
  Performance=rbind(Performance,data.frame(Degree=d,
                                           Data='Test',
  rmse=RMSE(testingdata$nox,predict(polyfit,newdata = testingdata))))
}
ggplot(Performance,aes(Degree,rmse,linetype=Data))+geom_point()+geom_line()
二维码

扫码加我 拉你入群

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

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

关键词:gplot plot GPL performance Performan

沙发
飞天玄舞6 在职认证  发表于 2016-10-29 14:08:53
下载后还得加载:library(ggplot2)

藤椅
xianchen321 发表于 2016-10-29 14:29:40
飞天玄舞6 发表于 2016-10-29 14:08
下载后还得加载:library(ggplot2)
RMSE函数又找不到了,下载了sjmisc但是跑起来还是说找不到RMSE,您知道在哪里吗?

板凳
li393446119 发表于 2016-10-30 16:06:23
学习R这段时间,总体的感觉就是,package的安装和调用都用R,其他的用studio。install.package用studio的话,总出错。

报纸
woshiisp 在职认证  发表于 2016-10-30 19:30:57
要先安装啊?!不安装是无法加载的!

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-25 18:06