R语言连接Mysql数据库

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了R语言连接Mysql数据库相关的知识,希望对你有一定的参考价值。

install.packages("DBI")

install.packages("Rmysql")

library(DBI)

library(RMySQL)

con <- dbConnect(MySQL(),host="XXXXX",dbname="stocku",user="root",password="XXXX")

dbListTables(con)


dbReadTable(con, "stockbase")


dbDisconnect(con)


300G
的数据慢慢分析吧

////////////////////

[7057] "002630_W"    "002630_tick" "002631_15"  
 [7060] "002631_30"   "002631_5"    "002631_60"  
 [7063] "002631_D"    "002631_M"    "002631_W"   
 [7066] "002631_tick" "002632_15"   "002632_30"  
 [7069] "002632_5"    "002632_60"   "002632_D"   
 [7072] "002632_M"    "002632_W"    "002632_tick"
 [7075] "002633_15"   "002633_30"   "002633_5"   
 [7078] "002633_60"   "002633_D"    "002633_M"   
 [7081] "002633_W"    "002633_tick" "002635_15"  
 [7084] "002635_30"   "002635_5"    "002635_60"  
 [7087] "002635_D"    "002635_M"    "002635_W"   
 [7090] "002635_tick" "002636_15"   "002636_30"  
 [7093] "002636_5"    "002636_60"   "002636_D"   
 [7096] "002636_M"    "002636_W"    "002636_tick"
 [7099] "002637_15"   "002637_30"   "002637_5"   
 [7102] "002637_60"   "002637_D"    "002637_M"   
 [7105] "002637_W"    "002637_tick" "002638_15"  
 [7108] "002638_30"   "002638_5"    "002638_60"  
 [7111] "002638_D"    "002638_M"    "002638_W"   
 [7114] "002638_tick" "002639_15"   "002639_30"  
 [7117] "002639_5"    "002639_60"   "002639_D"   
 [7120] "002639_M"    "002639_W"    "002639_tick"
 [7123] "002640_15"   "002640_30"   "002640_5"   
 [7126] "002640_60"   "002640_D"    "002640_M"  
 
 
   reservedPerShare    esp   bvps      pb timeToMarket
1                0.19  0.361   7.46    3.95     20160928
2                0.46  0.222   4.41    4.41     20160928
3                0.73  0.371   5.51    4.22     20160928
4                0.15  0.115   2.97    4.65     20160919
5                0.04  0.263   2.54    7.52     20061128
6                0.41  0.014   2.16   11.18     20140801
7                0.22  0.069   2.13   10.50     20160914
8                2.52  0.047   3.88    2.12     20100520
9                0.20  0.256   4.61    1.86     20160923
10               0.67  0.211   4.12    9.13     20160913

//////////////////////////////////////

本文出自 “坐坐吧” 博客,请务必保留此出处http://lwglucky.blog.51cto.com/1228348/1858657

以上是关于R语言连接Mysql数据库的主要内容,如果未能解决你的问题,请参考以下文章

R语言使用RMySQL连接及读写Mysql数据库 测试通过

R语言使用RMySQL连接及读写Mysql数据库

R语言--操作MySQL数据库

R语言链接数据库

部分代码片段

R语言连接MySQL报错:could not run statement: The used command is not allowed with this MySQL version