Skip to contents

This function reads xpm (X PixMap) files, validates their existence, and returns parsed data structures in a list format.

Usage

read_xpm(xpm_files)

Arguments

xpm_files

a character vector containing paths to one or more xpm files.

Value

list with the following components:

  • data - Data frame containing matrix values with coordinates

  • title - Chart title extracted from xpm

  • legend - Legend text extracted from xpm

  • x_label - X-axis label extracted from xpm

  • y_label - Y-axis label extracted from xpm

  • color_map - Named list mapping color codes to hex values

  • color_values - Named list mapping color codes to numeric values

Details

The function performs the following operations:

  1. Validates input type (must be character vector)

  2. Checks for file existence and filters missing files with warnings

  3. Reads valid files and parses them using parse_xpm()

  4. Returns aggregated results in a named list

Examples

# \donttest{
library(xvm)
# Retrieve the path to the example file included in the package
xpm_file_path <- system.file("extdata/gibbs.xpm", package = "xvm")
xpm_data <- read_xpm(xpm_file_path) # read the xpm file using read_xpm() function
#> Dimensions parsed: width = 32, height = 32, colors = 50
names(xpm_data)
#> [1] "gibbs.xpm"
# }