read_xpm {xvm} | R Documentation |
read xpm files
Description
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. |
Details
The function performs the following operations:
Validates input type (must be character vector)
Checks for file existence and filters missing files with warnings
Reads valid files and parses them using
parse_xpm()
Returns aggregated results in a named list
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
Examples
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
names(xpm_data)