Skip to contents

Loads and returns a named list of built-in example datasets that are included with the polarisR package. These datasets are specifically chosen to demonstrate different characteristics and challenges in non-linear dimensionality reduction analysis and visualization.

Usage

load_custom_datasets()

Value

A named list containing the successfully loaded datasets. Each element is a data.frame with the following structure:

  • $four_clusters: data.frame with cluster analysis data

  • $pdfsense: data.frame with high-dimensional physics data

If any dataset fails to load, a warning is issued but the function continues, returning only the successfully loaded datasets. An empty list is returned if no datasets can be loaded.

Note

The function uses data to load datasets from the package namespace. If the polarisR package is not properly installed or the data files are missing, warnings will be generated for the affected datasets.

Error Handling

The function includes robust error handling:

  • Each dataset is loaded in a separate tryCatch block

  • Loading failures generate warnings rather than stopping execution

  • Existence checks ensure datasets are properly loaded before inclusion

  • Environment management prevents namespace pollution

Usage in Application

This function is typically called during application initialization to populate the example dataset dropdown in the UI. The returned list is stored in a reactive value and can be dynamically extended with user-uploaded datasets.

See also

  • four_clusters for four_clusters dataset documentation

  • pdfsense for pdfsense dataset documentation

  • data for dataset loading mechanism

Author

GSoC Contributor

Examples

if(interactive()){
# Load all available datasets
datasets <- load_custom_datasets()
names(datasets)  # Shows available dataset names

# Check what was successfully loaded
if ("four_clusters" %in% names(datasets)) {
  dim(datasets$four_clusters)
  head(datasets$four_clusters)
}

# Use in shiny application initialization
custom_datasets <- shiny::reactiveVal(load_custom_datasets())
available_datasets <- shiny::reactiveVal(
  c("None", names(load_custom_datasets()))
)
}