数据库与R的建议 [英] Recommendations for database with R

查看:167
本文介绍了数据库与R的建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用R使用时间序列数据运行模拟。我一直在使用数组来存储数据,但我需要一个较少的内存密集型解决方案,用于在中间步骤存储数据,以记录过程。我不是一个程序员,所以我正在寻找一些相对容易在多个平台上安装(如果可能的话,Windows,Mac,Linux)。我还需要能够直接从R调用数据库,因为学习另一种语言现在是不可行的。理想情况下,我想能够以类似于数组的方式读取和写入数据库,虽然我不知道这是否是现实的。我会很乐意牺牲速度以方便使用,但我愿意努力学习开源解决方案。

I am using R to run simulations using time series data. I have been using arrays to store data but I need a less memory intensive solution for storing data at intermediate steps in order to document the process. I am not a programmer so I am looking for something relatively easy to setup on multiple platforms if possible (Windows, Mac, Linux). I also need to be able to directly call the database from R since learning another language is not feasible now. Ideally, I would like to be able to read and write frequently to the database in a manner similar to an array though I don't know if that is realistic. I will gladly sacrifice speed for ease of use but I am willing to work to learn open source solutions. Any suggestions would be appreciated.

推荐答案


我还需要能够直接
调用数据库从

I also need to be able to directly call the database from R

我建议用RMySQL界面设置MySQL。

I suggest setting up MySQL with RMySQL interface.

一旦DB连接打开,您可以查询数据库并将数据导入R,例如:

Once the DB connection is open, you can query the database and get the the data into R, example:

# Run an SQL statement by creating first a resultSet object
rs <- dbSendQuery(con, statement = paste(
                      "SELECT w.laser_id, w.wavelength, p.cut_off",
                      "FROM WL w, PURGE P",
                      "WHERE w.laser_id = p.laser_id",
                      "SORT BY w.laser_id")
# we now fetch records from the resultSet into a data.frame
data <- fetch(rs, n = -1)   # extract all rows

RMySQL :R接口到MySQL数据库

RMySQL: R interface to the MySQL database


数据库界面和MySQL驱动程序
for R。此版本符合
数据库接口定义为
在包DBI 0.2-2中实现。

Database interface and MySQL driver for R. This version complies with the database interface definition as implemented in the package DBI 0.2-2.

MySQL数据库

可用于您在问题中引用的所有平台,以及更多,请下载这里

Available for all the platforms you cited in the question, and more, download here.

这篇关于数据库与R的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆