#install.packages("heatmaply")
library("heatmaply")
## Loading required package: plotly
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
## Loading required package: viridis
## Loading required package: viridisLite
## 
## ======================
## Welcome to heatmaply version 1.4.2
## 
## Type citation('heatmaply') for how to cite the package.
## Type ?heatmaply for the main documentation.
## 
## The github page is: https://github.com/talgalili/heatmaply/
## Please submit your suggestions and bug-reports at: https://github.com/talgalili/heatmaply/issues
## You may ask questions at stackoverflow, use the r and heatmaply tags: 
##   https://stackoverflow.com/questions/tagged/heatmaply
## ======================
df <- normalize(mtcars)
df
##                           mpg cyl       disp         hp       drat         wt
## Mazda RX4           0.4510638 0.5 0.22175106 0.20494700 0.52534562 0.28304781
## Mazda RX4 Wag       0.4510638 0.5 0.22175106 0.20494700 0.52534562 0.34824853
## Datsun 710          0.5276596 0.0 0.09204290 0.14487633 0.50230415 0.20634109
## Hornet 4 Drive      0.4680851 0.5 0.46620105 0.20494700 0.14746544 0.43518282
## Hornet Sportabout   0.3531915 1.0 0.72062859 0.43462898 0.17972350 0.49271286
## Valiant             0.3276596 0.5 0.38388626 0.18727915 0.00000000 0.49782664
## Duster 360          0.1659574 1.0 0.72062859 0.68197880 0.20737327 0.52595244
## Merc 240D           0.5957447 0.0 0.18857570 0.03533569 0.42857143 0.42879059
## Merc 230            0.5276596 0.0 0.17385882 0.15194346 0.53456221 0.41856303
## Merc 280            0.3744681 0.5 0.24070841 0.25088339 0.53456221 0.49271286
## Merc 280C           0.3148936 0.5 0.24070841 0.25088339 0.53456221 0.49271286
## Merc 450SE          0.2553191 1.0 0.51060115 0.45229682 0.14285714 0.65379698
## Merc 450SL          0.2936170 1.0 0.51060115 0.45229682 0.14285714 0.56686269
## Merc 450SLC         0.2042553 1.0 0.51060115 0.45229682 0.14285714 0.57964715
## Cadillac Fleetwood  0.0000000 1.0 1.00000000 0.54063604 0.07834101 0.95551010
## Lincoln Continental 0.0000000 1.0 0.97006735 0.57597173 0.11059908 1.00000000
## Chrysler Imperial   0.1829787 1.0 0.92017960 0.62897527 0.21658986 0.97980056
## Fiat 128            0.9361702 0.0 0.01895735 0.04946996 0.60829493 0.17565840
## Honda Civic         0.8510638 0.0 0.01147418 0.00000000 1.00000000 0.02608029
## Toyota Corolla      1.0000000 0.0 0.00000000 0.04593640 0.67281106 0.08233188
## Toyota Corona       0.4723404 0.0 0.12222499 0.15901060 0.43317972 0.24341601
## Dodge Challenger    0.2170213 1.0 0.61586431 0.34628975 0.00000000 0.51316799
## AMC Javelin         0.2042553 1.0 0.58094288 0.34628975 0.17972350 0.49143442
## Camaro Z28          0.1234043 1.0 0.69568471 0.68197880 0.44700461 0.59498849
## Pontiac Firebird    0.3744681 1.0 0.82040409 0.43462898 0.14746544 0.59626694
## Fiat X1-9           0.7191489 0.0 0.01970566 0.04946996 0.60829493 0.10790079
## Porsche 914-2       0.6638298 0.0 0.12272387 0.13780919 0.76958525 0.16031705
## Lotus Europa        0.8510638 0.0 0.05986530 0.21554770 0.46543779 0.00000000
## Ford Pantera L      0.2297872 1.0 0.69817910 0.74911661 0.67281106 0.42367681
## Ferrari Dino        0.3957447 0.5 0.18433525 0.43462898 0.39631336 0.32140118
## Maserati Bora       0.1957447 1.0 0.57345972 1.00000000 0.35944700 0.52595244
## Volvo 142E          0.4680851 0.0 0.12446994 0.20141343 0.62211982 0.32395807
##                           qsec vs am gear      carb
## Mazda RX4           0.23333333  0  1  0.5 0.4285714
## Mazda RX4 Wag       0.30000000  0  1  0.5 0.4285714
## Datsun 710          0.48928571  1  1  0.5 0.0000000
## Hornet 4 Drive      0.58809524  1  0  0.0 0.0000000
## Hornet Sportabout   0.30000000  0  0  0.0 0.1428571
## Valiant             0.68095238  1  0  0.0 0.0000000
## Duster 360          0.15952381  0  0  0.0 0.4285714
## Merc 240D           0.65476190  1  0  0.5 0.1428571
## Merc 230            1.00000000  1  0  0.5 0.1428571
## Merc 280            0.45238095  1  0  0.5 0.4285714
## Merc 280C           0.52380952  1  0  0.5 0.4285714
## Merc 450SE          0.34523810  0  0  0.0 0.2857143
## Merc 450SL          0.36904762  0  0  0.0 0.2857143
## Merc 450SLC         0.41666667  0  0  0.0 0.2857143
## Cadillac Fleetwood  0.41428571  0  0  0.0 0.4285714
## Lincoln Continental 0.39523810  0  0  0.0 0.4285714
## Chrysler Imperial   0.34761905  0  0  0.0 0.4285714
## Fiat 128            0.59166667  1  1  0.5 0.0000000
## Honda Civic         0.47857143  1  1  0.5 0.1428571
## Toyota Corolla      0.64285714  1  1  0.5 0.0000000
## Toyota Corona       0.65595238  1  0  0.0 0.0000000
## Dodge Challenger    0.28214286  0  0  0.0 0.1428571
## AMC Javelin         0.33333333  0  0  0.0 0.1428571
## Camaro Z28          0.10833333  0  0  0.0 0.4285714
## Pontiac Firebird    0.30357143  0  0  0.0 0.1428571
## Fiat X1-9           0.52380952  1  1  0.5 0.0000000
## Porsche 914-2       0.26190476  0  1  1.0 0.1428571
## Lotus Europa        0.28571429  1  1  1.0 0.1428571
## Ford Pantera L      0.00000000  0  1  1.0 0.4285714
## Ferrari Dino        0.11904762  0  1  1.0 0.7142857
## Maserati Bora       0.01190476  0  1  1.0 1.0000000
## Volvo 142E          0.48809524  1  1  0.5 0.1428571
setwd("C:\\Users\\xut2\\Desktop")
dir.create("folder")
## Warning in dir.create("folder"): 'folder' already exists
heatmaply(df, file = "folder/heatmaply_plot.html")
#browseURL("folder/heatmaply_plot.html")
#https://www.datanovia.com/en/blog/how-to-create-a-beautiful-interactive-heatmap-in-r/
#https://cran.r-project.org/web/packages/heatmaply/vignettes/heatmaply.html