首页 > 学院 > 开发设计 > 正文

R中安装sqldb包报错解决办法

2019-11-10 18:46:09
字体:
来源:转载
供稿:网友

我使用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 fileWarning 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: tcltkWarning 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 carbValiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表