Skip to contents

This function processes a dataset containing multiple subsets, each identified by a unique 'file' identifier, and converts each subset into a matrix based on binned 'Angle' and 'Intensity' values. It ensures consistent binning across all subsets by using global minimum and maximum values, facilitating direct comparison between the resulting matrices.

Usage

convert_to_image(data, n_resolution = 100)

Arguments

data

A data frame or list of data frames containing at least three columns: 'file' (unique identifier for each subset), 'Angle', and 'Intensity'. Each row represents an observation with a specific angle and intensity value.

n_resolution

The number of bins

Value

A list containing: - matrices_list: A list where each element is a data frame corresponding to a subset identified by 'file', containing the original data. - bin_edges_Angle: Numeric vector of bin edges used for the 'Angle' dimension. - bin_edges_Intensity: Numeric vector of bin edges used for the 'Intensity' dimension. - counts_list: A list of matrices where each matrix represents the binned counts of 'Angle' and 'Intensity' for a subset.

Examples

if (FALSE) { # \dontrun{
# Assume 'data' is your dataset containing 'file', 'Angle', and 'Intensity' columns
result <- convert_to_image(data)

# Access the binned counts matrix for the first file
first_counts_matrix <- result$counts_list[[1]]

# Plot the matrix as an image
image(result$bin_edges_Angle, result$bin_edges_Intensity, first_counts_matrix)
} # }