プライマリ・コンテンツに移動
Oracle® R Enterpriseユーザーズ・ガイド
リリース1.5.1
E88296-01
目次へ移動
目次
索引へ移動
索引

前
次

2.2.3 データベースに対するデータの移動

ore.push関数を使用して、ローカルのRオブジェクトから一時データベース表およびそれに対応するプロキシore.frameオブジェクトを作成できます。

ore.pull関数を使用して、Oracle R Enterpriseプロキシ・オブジェクトが表すデータのコピーを含むローカルのRオブジェクトを作成できます

ore.push関数は、Rオブジェクトを適切なデータ型のOracle R Enterpriseオブジェクトに変換します。ore.pull関数は、oreクラス・オブジェクトを取得してRオブジェクトを返します。入力オブジェクトがore.listの場合、ore.pull関数はdata.frameを作成し、各データベース列の各データを適切なR表現に変換します。

注意:

データがRセッション・メモリーに適合する場合にのみ、データをローカルRのdata.frameにプルできます。また、データがメモリーに適合しても非常に大きい場合は、多数の、またはすべてのR関数をクライアントRセッションで実行できない可能性があります。

明示的に保存しないかぎり、ore.push関数を使用して作成した一時データベース表および対応するOracle R Enterpriseプロキシ・オブジェクトは、Rセッションの終了時に破棄されます。

関連項目:

例2-16 データを移動するためのore.pushおよびore.pullの使用方法

この例は、Rのdata.frameオブジェクトを関連するore.frameオブジェクト(iris_of)とともに一時データベース表としてデータベースにプッシュし、iris_ofから1列を選択することによって別のore.frameオブジェクト(iris_of_setosa)を作成した後に、iris_of_setosaオブジェクトをdata.frameオブジェクトとしてローカルのRセッション・メモリーにプルすることを示します。この例では、一部のオブジェクトのクラスを表示します。

class(iris)
# Push the iris data frame to the database.
iris_of <- ore.push(iris)
class(iris_of)
# Display the data type of the Sepal.Length column in the data.frame.
class(iris$Sepal.Length)
# Display the data type of the Sepal.Length column in the ore.frame.
class(iris_of$Sepal.Length)
# Filter one column of the data set.
iris_of_setosa <- iris_of[iris_of$Species == "setosa", ]
class(iris_of_setosa)
# Pull the selected column into the local R client memory.
local_setosa = ore.pull(iris_of_setosa)
class(local_setosa)
この例のリスト
R> class(iris)
[1] "data.frame"
R> # Push the iris data frame to the database.
R> iris_of <- ore.push(iris)
R> class(iris_of)
[1] "ore.frame"
attr(,"package")
[1] "OREbase"
R> # Display the data type of the Sepal.Length column in the data.frame.
R> class(iris$Sepal.Length)
[1] "numeric"
R> # Display the data type of the Sepal.Length column in the ore.frame.
R> class(iris_of$Sepal.Length)
[1] "ore.numeric"
attr(,"package")
[1] "OREbase"
R> # Filter one column of the data set.
R> iris_of_setosa <- iris_of[iris_of$Species == "setosa", ]
R> class(iris_of_setosa)
[1] "ore.frame"
attr(,"package")
[1] "OREbase"
R> # Pull the selected column into the local R client memory.
R> local_setosa = ore.pull(iris_of_setosa)
R> class(local_setosa)
[1] "data.frame"