将R对象存储在关系数据库中 [英] Storing R Objects in a relational database

查看:138
本文介绍了将R对象存储在关系数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常在从关系数据库中取出的数据上创建非参数统计(黄土,内核密度等)。为了使数据管理更容易我想把R输出存储在我的DB。这很容易与简单的数字帧的数字或文本,但我还没有想出如何存储R对象回我的关系数据库。那么是否有一种方法来存储内核密度的向量,例如,回到关系数据库?

I frequently create nonparametric statistics (loess, kernel densities, etc) on data I pull out of a relational database. To make data management easier I would like to store R output back inside my DB. This is easy with simple data frames of numbers or text, but I have not figured out how to store R objects back in my relational database. So is there a way to store a vector of kernel densities, for example, back into a relational database?

现在我通过将R对象保存到网络驱动器空间来解决这个问题,以便其他人可以根据需要加载对象。

Right now I work around this by saving the R objects to a network drive space so others can load the objects as needed.

推荐答案

使用序列化功能将任何R对象转换为(原始或字符)字符串,然后存储该字符串。请参阅 help(serialize)

Use the serialization feature to turn any R object into a (raw or character) string, then store that string. See help(serialize).

反向检索:获取字符串,然后 unserialize()转换为R对象。

Reverse this for retrieval: get the string, then unserialize() into a R object.

这篇关于将R对象存储在关系数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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