Oracle R Enterpriseのサンプル・スクリプトはdemo
関数を使用して実行できます。ほとんどの例では、R Distributionに含まれているdatasets
パッケージにあるiris
データセットを使用します。
サンプル・スクリプトを実行するには、Rを起動し、ORE
パッケージをlibrary(ORE)
を指定してロードし、データベースに接続してから、demo
関数を使用します。
例1-7では、basic.R
サンプル・スクリプトを実行します。例の後にあるリストには、スクリプトの出力の最初の数行のみが表示されています。このスクリプトはインメモリー・データベース・オブジェクトであるIRIS_TABLE
を作成しますが、これはore.frame
オブジェクトです。このスクリプトは次に、iris
のdata.frame
およびIRIS_TABLE
のore.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.