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

前
前へ
次
次へ

1.7.2 Oracle R Enterpriseのサンプル・スクリプトの実行

Oracle R Enterpriseのサンプル・スクリプトはdemo関数を使用して実行できます。ほとんどの例では、R Distributionに含まれているdatasetsパッケージにあるirisデータセットを使用します。

サンプル・スクリプトを実行するには、Rを起動し、OREパッケージをlibrary(ORE)を指定してロードし、データベースに接続してから、demo関数を使用します。

例1-7では、basic.Rサンプル・スクリプトを実行します。例の後にあるリストには、スクリプトの出力の最初の数行のみが表示されています。このスクリプトはインメモリー・データベース・オブジェクトであるIRIS_TABLEを作成しますが、これはore.frameオブジェクトです。このスクリプトは次に、irisdata.frameおよびIRIS_TABLEore.frameが同じ構造を持ち、同じデータを含んでいることを示します。

例1-7 basic.Rサンプル・スクリプトの実行

demo("basic", package = "ORE")
例1-7のリスト
R> demo("basic", package = "ORE")

        demo(basic)
        ---- ~~~~~
 
Type  <Return>   to start : 
 
R> #
R> #     O R A C L E  R  E N T E R P R I S E  S A M P L E   L I B R A R Y
R> #
R> #     Name: basic.R
R> #     Description: Demonstrates basic connectivity to database
R> #
R> #
R> #
R> 
R> ## Set page width
R> options(width = 80)
 
R> # Push the built-in iris data frame to the database
R> IRIS_TABLE <- ore.push(iris)
 
R> # Display the class of IRIS_TABLE 
R> class(IRIS_TABLE)
[1] "ore.frame"
attr(,"package")
[1] "OREbase"
 
R> # Basic commands
R> 
R> # Number of rows
R> nrow(iris)
[1] 150
 
R> nrow(IRIS_TABLE)
[1] 150
 
R> # Column names of the data frame
R> names(iris)
[1] "Sepal.Length" "Sepal.Width"  "Petal.Length" "Petal.Width"  "Species"     
 
R> names(IRIS_TABLE)
[1] "Sepal.Length" "Sepal.Width"  "Petal.Length" "Petal.Width"  "Species"     

# The rest of the output is not shown.