• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

R语言安装sqldb包报错解决办法

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

我使用Rtudio环境,安装sqldb几次出错。网上没有好的教程。

经过自己试验之后,这样处理。我写出来以后,供大家参考。

> install.packages("sqldf")
also installing the dependencies ‘BH’, ‘plogr’, ‘gsubfn’, ‘proto’, ‘RSQLite’, ‘DBI’, ‘chron’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/BH_1.62.0-1.zip'
Content type 'application/zip' length 16150075 bytes (15.4 MB)
downloaded 3.8 MB
...

Warning in install.packages :
  error 1 in extracting from zip file
Warning in install.packages :
  cannot open compressed file 'BH/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection

解决办法:
1.彻底退出你的360。
2.在RStudio里设置在某个镜像站下载包的
在Rtudio中菜单栏点击tool>global option>packages>change
选择China (Beijing) [https] - TUNA Team, Tsinghua University

然后就可以安装出来了。

> install.packages("sqldf")
also installing the dependencies ‘BH’, ‘plogr’, ‘gsubfn’, ‘proto’, ‘RSQLite’, ‘DBI’, ‘chron’
...
The downloaded binary packages are in
    C:\Users\yichenfan\AppData\Local\Temp\RtmpOO6hO7\downloaded_packages

输入library(sqldf)

> library(sqldf)
载入需要的程辑包:gsubfn
载入需要的程辑包:proto
载入需要的程辑包:RSQLite
> newdf<-sqldf("select * from mtcars where carb=1 order by mpg",row.names=TRUE)
Loading required package: tcltk
Warning message:
Quoted identifiers should have class SQL, use DBI::SQL() if the caller performs the quoting. 

我们看到又出错了。

我们检查一下tcltk

> capabilities()["tcltk"]
tcltk 
 TRUE 

此时我们使用SQL语句,就可以操作了

> library(sqldf)
> newdf<-sqldf("select * from mtcars where carb=1 order by mpg",row.names=TRUE)
> newdf
                mpg cyl  disp  hp drat    wt  qsec vs am gear carb
Valiant        18.1   6 225.0 105 2.76 3.460 20.22  1  0    3    1
Hornet 4 Drive 21.4   6 258.0 110 3.08 3.215 19.44  1  0    3    1
Toyota Corona  21.5   4 120.1  97 3.70 2.465 20.01  1  0    3    1
Datsun 710     22.8   4 108.0  93 3.85 2.320 18.61  1  1    4    1
Fiat X1-9      27.3   4  79.0  66 4.08 1.935 18.90  1  1    4    1
Fiat 128       32.4   4  78.7  66 4.08 2.200 19.47  1  1    4    1
Toyota Corolla 33.9   4  71.1  65 4.22 1.835 19.90  1  1    4    1

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
R语言学习——循环判断语句发布时间:2022-07-18
下一篇:
人工智能入门-R语言数据分析与数63发布时间:2022-07-18
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap