dbListTable函数错误

时间:2016-12-13 22:12:40

标签: mysql r rmysql

我正在尝试在R中建立一个MySQL数据库。我已经安装了RMySQL并成功建立了连接。我也能够成功使用dbWriteTable()函数,但当我尝试使用dbListTables()时,它会给我一个错误说

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘dbListTables’ for signature ‘"missing"

有人可以对此有所了解吗? 下面是代码:

#Install and load Quandl package
install.packages("Quandl")
library(Quandl)

#Install and load SQL package
install.packages("RMySQL")
library(RMySQL)

#Authenicate API key
Quandl.api_key("________")

#Load top 10 biggest Healthcare compaines in Fortune 500 according to 
#http://fortune.com/2015/06/20/fortune-500-biggest-healthcare-companies/
CVS <- Quandl("WIKI/CVS")
McKesson <- Quandl("WIKI/MCK")
UnitedHealthGroup <- Quandl("WIKI/UNH")
AmerisourceBergern <- Quandl("WIKI/ABC")
ExpressScriptsHolding <- Quandl("WIKI/ESRX")
CardinalHealth <- Quandl("WIKI/CAH")
Walgreens <- Quandl("WIKI/WBA")
Johnson_Johnson <- Quandl("WIKI/JNJ")
Anthem <- Quandl("WIKI/ANTM")
Aetna <- Quandl("WIKI/AET")

con <- dbConnect(MySQL(),
                user = 'root',
                password = 'password',
                dbname = 'mysql')

dbWriteTable(con, value = Aetna, name =  "Aetna")
dbListTables()

1 个答案:

答案 0 :(得分:1)

我明白我做错了什么。我没有向con函数提供连接变量dbListTables()。我试过了dbListTables(con),它运作得很好。