安装R
step1:登录R的官方网站
https://www.r-project.org/
安装RStudio
step1:打开RStudio官方网站 https://www.rstudio.com/products/rstudio/download/ 点击Free下的Download
R官方资源目录:
https://cran.cnr.berkeley.edu/doc/contrib/
安装RMySQL包:
install.packages('RMySQL')
载入需要的程辑包:DBI
> con <- dbConnect(MySQL(),host="127.0.0.1",dbname="test",user="test",password="test123456")
> summary(con)
> dbGetInfo(con)
> dbListTables(con)
> x <- rnorm ( 100 ,mean = 5 ,sd = 0.1 )
> mean( x )
[1] 4.981732
> sd(x)
[1] 0.1038143
> summary(x)
Min. 1st Qu. Median Mean 3rd Qu. Max.
4.750 4.908 4.964 4.982 5.053 5.261
> print(x)
[1] 4.982225 4.951910 5.149117 5.012832 4.960257 4.812589 4.858578 4.904353
[9] 5.089108 5.066379 4.927493 4.752623 5.019594 5.007841 4.941957 4.983573
[17] 4.839522 5.121196 5.168398 5.084770 4.955885 4.947208 4.992710 4.979633
[25] 5.120267 4.905479 4.959099 5.093718 4.932572 5.046054 4.842912 4.850113
[33] 4.829622 4.933419 4.923957 5.069534 5.235331 4.943534 5.055934 4.965457
[41] 4.965448 4.960240 4.889325 4.948669 4.963264 4.958626 4.829810 5.123670
[49] 5.213713 4.962652 5.049703 4.850500 5.029388 5.071346 4.936869 5.037264
[57] 4.750394 4.804740 5.046051 5.261270 5.077190 5.094571 4.892364 4.973856
[65] 4.999509 4.902441 4.889222 5.080576 4.917315 5.005478 4.998123 5.031426
[73] 5.111170 5.110377 4.908666 4.945858 4.905541 4.949467 4.883691 4.956642
[81] 5.032479 5.041712 5.116697 4.873334 5.131218 4.951192 5.116555 5.104005
[89] 5.079456 4.878366 5.022186 4.949673 4.883831 4.821645 4.882331 5.052662
[97] 5.005559 4.945199 4.981499 4.800398
> plot(x) 散点图表
> barplot(c) 柱状图表
> demo(graphics) 各种漂亮和曲线图