[R筆記] R + MongoDB - 安裝教學

這篇要來介紹R跟MongoDB要怎麼溝通,先到CRAN R查查目前有什麼package是支援R與MongoDB的溝通。
http://cran.r-project.org/web/packages/available_packages_by_name.html

搜尋後發現有兩個package可能會提供我們需要的功能,分別是RMongormongodb。RMongo內部是用mongo-java-driver,而rmongodb內部是用mongodb-c-driver。
兩個package都在github公開,RMongo屬於易簡單上手,但功能會比較少。rmongodb提供的文件比較詳細,功能也比較多,由MongoDB, Inc支援開發。安裝R package,就用install.packages('package_name')來安裝,安裝完成後,用library('package_name')將其載入。
> install.packages('rmongodb')
Installing package into ‘C:/Users/******/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/rmongodb_1.8.0.zip'
Content type 'application/zip' length 1174378 bytes (1.1 Mb)
opened URL
downloaded 1.1 Mb

package ‘rmongodb’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
 C:\Users\******\Temp\RtmpmmLVP9\downloaded_packages
> library(rmongodb)
WARNING!
There are some quite big changes in this version of rmongodb.
...

而MongoDB要怎麼安裝及使用,可以參考以下網址。
[Mongo] MongoDB 安裝及執行說明

沒有留言:

張貼留言