August F.Y. Chao

[R Project] How to use R to connect MySql, Step by Step.

In 01 論02 備忘錄21 碩班課業 on 三月 18, 2008 at 4:00 上午
  1. download R from R Project
  2. Update your packages
    1. setting CRAN image
    2. update packages
  3. install RMySQL
  4. google “libmysql.dll", download it, and extract into R’s directory/lirary/RMySQL/libs
  5. using following command

> library(RMySQL)
> mycon <- dbConnect(MySQL(), user=’cws’, dbname="cws", host="pi", password=’delores’)
> rs <- dbSendQuery(mycon, “SELECT slide_name FROM arrays limit 5″)
> data1 <- fetch(rs, n = -1)
> data1
slide_name
1 DM1-110
2 DM1-111
3 DM1-112
4 DM1-113
5 DM1-114

Advertisements

發表迴響

Please log in using one of these methods to post your comment:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s

%d 位部落客按了讚: