ore.datastore
関数およびore.datastoreSummary
関数を使用することで、現行のユーザー・スキーマのデータストアに関する情報を取得できます。
ore.datastore
関数を使用して、データストアに関する基本的な情報をリストできます。特定のタイプのデータストアに関する情報を取得するには、オプションの文字列引数type
を使用できます。type
の有効な値は次のとおりです。
現行のセッション・ユーザーが作成したデータストアをリストするuser
。これはデフォルト値です。
現行のセッション・ユーザーが他のユーザーに読取りアクセス権を付与できないデータストアをリストするprivate
。
現行のセッション・ユーザーが読取りアクセス権を持っているすべてのデータストアをリストするall
。
現行のセッション・ユーザーが他のユーザーに読取り権限を付与できるデータストアをリストするgrantable
。
現行のセッション・ユーザーが他のユーザーに読取り権限を付与したデータストアをリストするgrant
。
他のユーザーによって現行のセッション・ユーザーに読取り権限が付与されたデータストアをリストするgranted
。
タイプを指定しなかった場合、関数ore.datastore
は、データストア名、データストア内のオブジェクト数、データストアのサイズ、作成日および説明に対応する列を含むdata.frame
オブジェクトを返します。行は、列datastore.name
によってアルファベット順にソートされます。タイプを指定した場合、この関数は、指定したタイプの列を含むdata.frame
を返します。
名前または正規表現パターンを使用してデータストアを検索できます。
ore.datastoreSummary
関数は、接続されているデータベースのユーザー・スキーマにあるデータストアに保存されたRオブジェクトに関する情報を返します。この関数は、オブジェクト名、オブジェクト・クラス、オブジェクトのサイズおよびオブジェクトの長さ(vector
の場合)または行および列の数(data.frame
オブジェクトの場合)に対応する列を含んだdata.frame
を返します。これは、1つの必須の引数としてデータストアの名前を取りますが、オプションの引数としてデータストアの所有者を取ることもできます。
例2-20 ore.datastore関数の使用方法
この例では、ore.datastore
関数の使用方法を示します。この例では、例2-18で作成したRオブジェクトの一部を使用します。
# The datastore objects ds1 and ds2 and objects data.frame objects df1 and df2 # were created in Example 2-18. ore.save(df1, df2, name = "dfobj", description = "df objects" ore.save(x, y, z, name = "another_ds", description = "For pattern matching") # List all of the datastore objects. ore.datastore() # List the specified datastore. ore.datastore("ds1") # List the datastore objects with names that include "ds". ore.datastore(pattern = "ds")例2-20のリスト
R> # The datastore objects ds1 and ds2 and objects data.frame objects df1 and df2 R> # were created in Example 2-18. R> ore.save(df1, df2, name = "dfobj", description = "df objects" R> ore.save(x, y, z, name = "another_ds", description = "For pattern matching") R> R> # List all of the datastore objects. R> ore.datastore() datastore.name object.count size creation.date description 1 another_ds 3 1243 2014-07-24 13:31:56 For pattern mattching 2 dfobj 2 656 2014-07-24 13:31:46 df objects 3 ds1 4 3162 2014-07-24 13:25:17 My datastore 4 ds2 2 1111 2014-07-24 13:27:26 only x R> # List the specified datastore. R> ore.datastore("ds1") datastore.name object.count size creation.date description 1 ds1 4 2908 2013-11-08 10:41:09 My datastore R> R> # List the datastore objects with names that include "ds". R> ore.datastore(pattern = "ds") datastore.name object.count size creation.date description 1 another_ds 3 1243 2014-07-24 13:31:56 For pattern mattching 2 ds1 4 3162 2014-07-24 13:25:17 My datastore 3 ds2 2 1111 2014-07-24 13:27:26 only x
例2-21 ore.datastoreSummary関数の使用方法
この例では、ore.datastoreSummary
関数の使用方法を示します。この例では、例2-18で作成したデータストアを使用します。
ore.datastoreSummary("ds1") ore.datastoreSummary("ds2")例2-21のリスト
R> ore.datastoreSummary("ds1") object.name class size length row.count col.count 1 AIRQUALITY ore.frame 1077 6 153 6 2 df1 data.frame 328 2 5 2 3 df2 data.frame 328 2 5 2 4 iris_of ore.frame 1429 5 150 5 R> ore.datastoreSummary("ds2") object.name class size length row.count col.count 1 x numeric 182 20 NA NA 2 z ore.numeric 929 20 NA NA