Public methods
Method new()
Initialize an instance of a cube.
Usage
Cube$new(connection, cube_id, instance_id = NULL, parallel = FALSE)
Arguments
connection
MicroStrategy connection object. See Connection class.
cube_id
Identifier of a pre-existing cube containing the required data.
instance_id
Identifier of an instance if cube instance has been already initialized, NULL by default.
parallel
(bool, optional): If True, utilize optimal number of threads to increase the download
speed. If False (default), this feature will be disabled.
Method to_dataframe()
Extract contents of a cube into a R Data Frame.
Usage
Cube$to_dataframe(limit = NULL, multi_df = FALSE, callback = function(x, y) {
})
Arguments
limit
(int, optional): Used to control data extraction behaviour on cubes with a large number of rows. By
default the limit is calculated automatically. If TRUE, overrides automatic limit.
multi_df
If True (default), returns a list of dataframes resembling the table structure of the cube. If
FALSE, returns one dataframe.
callback
used by the GUI to extract the progress information.
Returns
Dataframe with data fetched from the given Cube.
Method apply_filters()
Apply filters on the cube data so only the chosen attributes, metrics, and attribute elements are
retrieved from the Intelligence Server.
Usage
Cube$apply_filters(
attributes = NULL,
metrics = NULL,
attr_elements = NULL,
operator = "In"
)
Arguments
attributes
(list or None, optional): ID numbers of attributes to be included in the filter. If list is
empty, no attributes will be selected and metric data will be aggregated.
metrics
(list or None, optional): ID numbers of metrics to be included in the filter. If list is empty,
no metrics will be selected.
attr_elements
(list or None, optional): Attributes' elements to be included in the filter.
operator
(character, optional): Supported view filter operators are either "In" or "NotIn". This defines
whether data will include ("In") or exclude ("NotIn") the supplied attr_elements values.
Method clear_filters()
Clear previously set filters, allowing all attributes, metrics, and attribute elements to be retrieved.
Usage
Cube$clear_filters()
Method get_attr_elements()
Load all attribute elements of the Cube. Accessible via Cube$attr_elements
Fetching attriubte elements will also allow for validating attriute elements by the filter object.
Usage
Cube$get_attr_elements(limit = 50000, verbose = TRUE)
Arguments
verbose
If TRUE, displays list of attribute elements.
Method update()
Update single-table cube easily with the data frame stored in the Cube instance (cube$dataframe).
Before the update, make sure that the data frame has been modified.
Usage
Cube$update(update_policy = "update")
Arguments
update_policy
(character) Update operation to perform. One of 'add' (inserts new, unique rows), 'update'
(updates data in existing rows and columns), 'upsert' (updates existing data and inserts new rows), or 'replace'
(replaces the existing data with new data).
Method save_as()
Creates a new single-table cube with the data frame stored in the Cube instance (cube$dataframe).
Before the update, make sure that the data exists.
Usage
Cube$save_as(name, description = NULL, folder_id = NULL, table_name = NULL)
Arguments
name
(character): Name of the dataset. Must be less than or equal to 250 characters.
description
(character, optional): Description of the dataset. Must be less than or equal to 250 characters.
folder_id
ID of the shared folder that the dataset should be created within. If `None`,
defaults to the user's My Reports folder.
table_name
(character, optional) Name of the table. If NULL, the first table name of the original cube will
be used.
Method clone()
The objects of this class are cloneable with this method.
Usage
Cube$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.