Model: Create the definition of multi-table and single-table...

ModelR Documentation

Create the definition of multi-table and single-table datasets

Description

Create the definition of a dataset containing one or more tables. The definition includes the name and description of the dataset and the name and description of each table, attribute, and metric within the dataset.

Public fields

tables

List containing lists of data.frames and corresponding table names

name

Name of the dataset

description

Description of the data set. Must be less than or equal to 250 characters

folder_id

ID of the shared folder that the dataset should be created within. If NULL, defaults to the user's My Reports folder

Methods

Public methods


Method new()

Usage
Model$new(tables, name, description = NULL, folder_id = NULL)

Method get_model()

Usage
Model$get_model()

Method get_name()

Usage
Model$get_name()

Method get_description()

Usage
Model$get_description()

Method get_folder_id()

Usage
Model$get_folder_id()

Method get_tables()

Usage
Model$get_tables()

Method get_attributes()

Usage
Model$get_attributes()

Method get_metrics()

Usage
Model$get_metrics()

Method clone()

The objects of this class are cloneable with this method.

Usage
Model$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

## Not run: 
# Create data frames
df1 <- data.frame("id" = c(1, 2, 3, 4, 5),
                  "first_name" = c("Jason", "Molly", "Tina", "Jake", "Amy"),
                  "last_name" = c("Miller", "Jacobson", "Turner", "Milner", "Cooze"))

df2 <- data.frame("id" = c(1, 2, 3, 4, 5),
                  "age" = c(42, 52, 36, 24, 73),
                  "state" = c("VA", "NC", "WY", "CA", "CA"),
                  "salary" = c(50000, 100000, 75000, 85000, 250000))

# Create a list of tables containing one or more tables and their names
tables = list(list("table_name" = "employee_id",
                    "data_frame" = df1),
              list("table_name" = "employee_data",
                   "data_frame" = df2))

# Generate the data model
model <- Model$new(tables=tables, name="Employees", description="Employee Analytics Data")
model_info <- model$get_model()

## End(Not run)

mstrio documentation built on April 13, 2022, 5:07 p.m.