Chapter 5 DataSheet Class

DataSheet is an R6 class designed for managing and manipulating datasets with metadata, filters, column selections, objects, calculations, keys, comments, and more. Below is the detailed documentation for each function within the DataSheet class, formatted in a roxygen2-style skeleton in markdown format.

5.1 Class Information

5.1.1 initialize

Initializes a new DataSheet object with specified data and settings.

  • Arguments:
    • data (data.frame, default: data.frame()): The initial dataset.
    • data_name (character, default: ""): Name of the dataset.
    • variables_metadata (data.frame, default: data.frame()): Metadata for the variables.
    • metadata (list, default: list()): Additional metadata for the dataset.
    • imported_from (character, default: ""): Source of the data import.
    • messages (logical, default: TRUE): Whether to display messages.
    • convert (logical, default: TRUE): Whether to convert the dataset.
    • create (logical, default: TRUE): Whether to create the dataset.
    • start_point (integer, default: 1): Starting point for the dataset.
    • filters (list, default: list()): Filters applied to the dataset.
    • column_selections (list, default: list()): Column selections for the dataset.
    • objects (list, default: list()): Objects associated with the dataset.
    • calculations (list, default: list()): Calculations to be applied to the dataset.
    • keys (list, default: list()): Keys for the dataset.
    • comments (list, default: list()): Comments on the dataset.
    • keep_attributes (logical, default: TRUE): Whether to keep attributes of the dataset.

5.1.2 set_data

Sets a new dataset for the DataSheet object.

  • Arguments:
    • new_data (data.frame): The new dataset to be set.
    • messages (logical, default: TRUE): Whether to display messages.
    • check_names (logical, default: TRUE): Whether to check and validate column names.

5.1.3 set_meta

Sets new metadata for the DataSheet object.

  • Arguments:
    • new_meta (list): New metadata to be set.

5.1.4 clear_metadata

Clears the existing metadata for the DataSheet object. Note: This function is potentially dangerous as it could remove necessary properties.

5.1.5 set_changes

Sets new changes for the DataSheet object.

  • Arguments:
    • new_changes (list): New changes to be set.

5.1.6 set_filters

Sets new filters for the DataSheet object.

  • Arguments:
    • new_filters (list): New filters to be set.

5.1.7 set_column_selections

Sets new column selections for the DataSheet object.

  • Arguments:
    • new_column_selections (list): New column selections to be set.

5.1.8 set_objects

Sets new objects for the DataSheet object.

  • Arguments:
    • new_objects (list): New objects to be set.

5.1.9 set_calculations

Sets new calculations for the DataSheet object.

  • Arguments:
    • new_calculations (list): New calculations to be set.

5.1.10 set_keys

Sets new keys for the DataSheet object.

  • Arguments:
    • new_keys (list): New keys to be set.

5.1.11 set_comments

Sets new comments for the DataSheet object.

  • Arguments:
    • new_comments (list): New comments to be set.

5.1.12 set_data_changed

Sets the data changed status for the DataSheet object.

  • Arguments:
    • new_val (logical): New value for the data changed status.

5.1.13 set_variables_metadata_changed

Sets the variables metadata changed status for the DataSheet object.

  • Arguments:
    • new_val (logical): New value for the variables metadata changed status.

5.1.14 set_metadata_changed

Sets the metadata changed status for the DataSheet object.

  • Arguments:
    • new_val (logical): New value for the metadata changed status.

5.1.15 get_data_frame

Retrieves the current data frame from the DataSheet object with various options for filtering, selection, and formatting.

  • Arguments:
    • convert_to_character (logical, default: FALSE): Whether to convert data to character.
    • include_hidden_columns (logical, default: TRUE): Whether to include hidden columns.
    • use_current_filter (logical, default: TRUE): Whether to use the current filter.
    • use_column_selection (logical, default: TRUE): Whether to use column selection.
    • filter_name (character, default: ""): Name of the filter to be used.
    • column_selection_name (character, default: ""): Name of the column selection to be used.
    • stack_data (logical, default: FALSE): Whether to stack the data.
    • remove_attr (logical, default: FALSE): Whether to remove attributes.
    • retain_attr (logical, default: FALSE): Whether to retain attributes.
    • max_cols (integer): Maximum number of columns to be returned.
    • max_rows (integer): Maximum number of rows to be returned.
    • drop_unused_filter_levels (logical, default: FALSE): Whether to drop unused filter levels.
    • start_row (integer): Starting row for the data.
    • start_col (integer): Starting column for the data.

5.2 Active Bindings

5.2.1 data_changed

Gets or sets the data changed status.

  • Arguments:
    • new_value (logical): New value for the data changed status.

5.2.2 metadata_changed

Gets or sets the metadata changed status.

  • Arguments:
    • new_value (logical): New value for the metadata changed status.

5.2.3 variables_metadata_changed

Gets or sets the variables metadata changed status.

  • Arguments:
    • new_value (logical): New value for the variables metadata changed status.

5.2.4 current_filter

Gets or sets the current filter.

  • Arguments:
    • filter (list): New filter to be set.

5.2.5 current_column_selection

Gets or sets the current column selection.

  • Arguments:
    • column_selection (list): New column selection to be set.