Code adapted from: ` https://jcoliver.github.io/learn-r/006-heatmaps.html
mine.data <- read.csv(file = "data.csv" )
install.packages("tidyr")
library ( "tidyr" )
mine.long <- gather(data = mine.data, key = Metabolite, value = Abundance)
head(mine.long)
str(mine.data)
mine.long <- gather(data = mine.data, key = Class, value = Abundance, -c( 1 : 1 ))
head(mine.long)
install.packages( "ggplot2" )
library ( "ggplot2" )
mine.heatmap <- ggplot(data = mine.long, mapping = aes(x = Sample.name,
y = Metabolite,
fill = Abundance)) +
geom_tile() +
xlab(label = "Sample" )
mine.heatmap
plot.object.name <- ggplot(data, mapping) +
layer.one() +
layer.two() +
layer.three()
plot.object.name
| Sample.name |
2-hydroxyglutarate |
3PG |
acetyl-lysine |
| N0_A |
-0.000536806 |
-0.074983518 |
-0.224292484 |
| N0_B |
-0.000833351 |
-0.031069135 |
-0.010536334 |
| N0_C |
-1.10E-05 |
-0.049364209 |
-0.040049633 |
| PMA_30min_A |
-0.570842671 |
0.864493538 |
-1.488582331 |
| PMA_30min_B |
-0.468878552 |
0.6895598 |
-2.726207287 |
| PMA_30min_C |
-0.843629046 |
0.703503689 |
-3.562324625 |