R pheatmap Error: 'object of type 'closure' is not subsettable'
The error message 'Error in color[1] : object of type 'closure' is not subsettable' in the pheatmap function indicates a problem with the color argument. The color argument should be a subsettable object (like a vector), but the issue arises when using colorRampPalette without assigning it to a variable.
To fix this, create a color palette using colorRampPalette and assign it to a variable. Then, use this variable as the color argument in the pheatmap function.
# Define the color palette
my_palette <- colorRampPalette(c('#FF0089', 'white', '#013AD5'))
# Generate the heatmap using the defined color palette
pheatmap(data, breaks = c(-2, -1, 0, 1, 2), color = my_palette)
Remember to replace data with your actual data object in the code.'}
原文地址: https://www.cveoy.top/t/topic/pKgv 著作权归作者所有。请勿转载和采集!