# Example heatmap data frame
heatdata <- data.frame(
groupA_1 = c(1, 2, 3),
groupA_2 = c(4, 5, 6),
groupB_1 = c(7, 8, 9),
groupB_2 = c(10, 11, 12)
)
# Selection 1: Use custom names for columns
custom_names <- c("Sample1", "Sample2", "Sample3", "Sample4")
processed_data1 <- process_heatdata(heatdata, selection = 1, custom_names = custom_names)
# Selection 2: Select a given number of columns per group based on a prefix
processed_data2 <- process_heatdata(heatdata, selection = 2, num_names_per_group = 1)
# Selection 3: Calculate the average of columns per group based on a prefix
processed_data3 <- process_heatdata(heatdata, selection = 3, prefix_length = 6)
Run the code above in your browser using DataLab