I'm trying to plot a heatmap in R using ggplot2.
A sample of my data is shown below :
tdftan1[1:513,]
structure(list(Row.names = structure(c("TCGA.02.0003.01", "TCGA.02.0010.01",
"TCGA.02.0011.01", "TCGA.02.0014.01", "TCGA.02.0024.01", "TCGA.02.0026.01",
"TCGA.02.0028.01", "TCGA.02.0046.01", "TCGA.02.0047.01", "TCGA.02.0048.01",
"TCGA.02.0060.01", "TCGA.02.0069.01", "TCGA.02.0074.01", "TCGA.02.0080.01",
"TCGA.02.0084.01", "TCGA.02.0087.01", "TCGA.02.0104.01", "TCGA.02.0114.01",
"TCGA.02.0281.01", "TCGA.02.0321.01", "TCGA.02.0325.01", "TCGA.02.0338.01",
"TCGA.02.0339.01", "TCGA.02.0432.01", "TCGA.02.0439.01", "TCGA.02.0440.01",
"TCGA.02.0446.01", "TCGA.06.0128.01", "TCGA.06.0129.01", "TCGA.06.0146.01",
"TCGA.06.0156.01", "TCGA.06.0166.01", "TCGA.06.0174.01", "TCGA.06.0177.01",
"TCGA.06.0238.01", "TCGA.06.0241.01", "TCGA.06.0410.01", "TCGA.06.0413.01",
"TCGA.06.0414.01", "TCGA.06.0646.01", "TCGA.06.0648.01", "TCGA.08.0245.01",
"TCGA.08.0344.01", "TCGA.08.0347.01", "TCGA.08.0348.01", "TCGA.08.0350.01",
"TCGA.08.0353.01", "TCGA.08.0359.01", "TCGA.08.0385.01", "TCGA.08.0517.01",
"TCGA.08.0524.01", "TCGA.12.0616.01", "TCGA.12.0618.01", "TCGA.02.0089.01",
"TCGA.02.0113.01", "TCGA.02.0115.01", "TCGA.02.0451.01", "TCGA.06.0132.01",
"TCGA.06.0133.01", "TCGA.06.0138.01", "TCGA.06.0160.01", "TCGA.06.0162.01",
"TCGA.06.0167.01", "TCGA.06.0171.01", "TCGA.06.0173.01", "TCGA.06.0179.01",
"TCGA.06.0182.01", "TCGA.06.0185.01", "TCGA.06.0195.01", "TCGA.06.0208.01",
"TCGA.06.0214.01", "TCGA.06.0219.01", "TCGA.06.0221.01", "TCGA.06.0237.01",
"TCGA.06.0240.01", "TCGA.08.0349.01", "TCGA.08.0380.01", "TCGA.08.0386.01",
"TCGA.08.0520.01", "TCGA.02.0007.01", "TCGA.02.0009.01", "TCGA.02.0016.01",
"TCGA.02.0021.01", "TCGA.02.0023.01", "TCGA.02.0027.01", "TCGA.02.0038.01",
"TCGA.02.0043.01", "TCGA.02.0070.01", "TCGA.02.0102.01", "TCGA.02.0260.01",
"TCGA.02.0269.01", "TCGA.02.0285.01", "TCGA.02.0289.01", "TCGA.02.0290.01",
"TCGA.02.0317.01", "TCGA.02.0333.01", "TCGA.02.0422.01", "TCGA.02.0430.01",
"TCGA.06.0125.01", "TCGA.06.0126.01", "TCGA.06.0137.01", "TCGA.06.0145.01",
"TCGA.06.0148.01", "TCGA.06.0187.01", "TCGA.06.0211.01", "TCGA.06.0402.01",
"TCGA.08.0246.01", "TCGA.08.0354.01", "TCGA.08.0355.01", "TCGA.08.0357.01",
"TCGA.08.0358.01", "TCGA.08.0375.01", "TCGA.08.0511.01", "TCGA.08.0514.01",
"TCGA.08.0518.01", "TCGA.08.0529.01", "TCGA.08.0531.01", "TCGA.02.0004.01",
"TCGA.02.0025.01", "TCGA.02.0033.01", "TCGA.02.0034.01", "TCGA.02.0039.01",
"TCGA.02.0051.01", "TCGA.02.0054.01", "TCGA.02.0057.01", "TCGA.02.0059.01",
"TCGA.02.0064.01", "TCGA.02.0075.01", "TCGA.02.0079.01", "TCGA.02.0085.01",
"TCGA.02.0086.01", "TCGA.02.0099.01", "TCGA.02.0106.01", "TCGA.02.0107.01",
"TCGA.02.0111.01", "TCGA.02.0326.01", "TCGA.02.0337.01", "TCGA.06.0122.01",
"TCGA.06.0124.01", "TCGA.06.0130.01", "TCGA.06.0139.01", "TCGA.06.0143.01",
"TCGA.06.0147.01", "TCGA.06.0149.01", "TCGA.06.0152.01", "TCGA.06.0154.01",
"TCGA.06.0164.01", "TCGA.06.0175.01", "TCGA.06.0176.01", "TCGA.06.0184.01",
"TCGA.06.0189.01", "TCGA.06.0190.01", "TCGA.06.0194.01", "TCGA.06.0197.01",
"TCGA.06.0210.01", "TCGA.06.0397.01", "TCGA.06.0409.01", "TCGA.06.0412.01",
"TCGA.06.0644.01", "TCGA.06.0645.01", "TCGA.08.0346.01", "TCGA.08.0352.01",
"TCGA.08.0360.01", "TCGA.08.0390.01", "TCGA.08.0392.01", "TCGA.08.0509.01",
"TCGA.08.0510.01", "TCGA.08.0512.01", "TCGA.08.0522.01", "TCGA.12.0619.01",
"TCGA.12.0620.01", "TCGA.02.0003.01", "TCGA.02.0010.01", "TCGA.02.0011.01",
"TCGA.02.0014.01", "TCGA.02.0024.01", "TCGA.02.0026.01", "TCGA.02.0028.01",
"TCGA.02.0046.01", "TCGA.02.0047.01", "TCGA.02.0048.01", "TCGA.02.0060.01",
"TCGA.02.0069.01", "TCGA.02.0074.01", "TCGA.02.0080.01", "TCGA.02.0084.01",
"TCGA.02.0087.01", "TCGA.02.0104.01", "TCGA.02.0114.01", "TCGA.02.0281.01",
"TCGA.02.0321.01", "TCGA.02.0325.01", "TCGA.02.0338.01", "TCGA.02.0339.01",
"TCGA.02.0432.01", "TCGA.02.0439.01", "TCGA.02.0440.01", "TCGA.02.0446.01",
"TCGA.06.0128.01", "TCGA.06.0129.01", "TCGA.06.0146.01", "TCGA.06.0156.01",
"TCGA.06.0166.01", "TCGA.06.0174.01", "TCGA.06.0177.01", "TCGA.06.0238.01",
"TCGA.06.0241.01", "TCGA.06.0410.01", "TCGA.06.0413.01", "TCGA.06.0414.01",
"TCGA.06.0646.01", "TCGA.06.0648.01", "TCGA.08.0245.01", "TCGA.08.0344.01",
"TCGA.08.0347.01", "TCGA.08.0348.01", "TCGA.08.0350.01", "TCGA.08.0353.01",
"TCGA.08.0359.01", "TCGA.08.0385.01", "TCGA.08.0517.01", "TCGA.08.0524.01",
"TCGA.12.0616.01", "TCGA.12.0618.01", "TCGA.02.0089.01", "TCGA.02.0113.01",
"TCGA.02.0115.01", "TCGA.02.0451.01", "TCGA.06.0132.01", "TCGA.06.0133.01",
"TCGA.06.0138.01", "TCGA.06.0160.01", "TCGA.06.0162.01", "TCGA.06.0167.01",
"TCGA.06.0171.01", "TCGA.06.0173.01", "TCGA.06.0179.01", "TCGA.06.0182.01",
"TCGA.06.0185.01", "TCGA.06.0195.01", "TCGA.06.0208.01", "TCGA.06.0214.01",
"TCGA.06.0219.01", "TCGA.06.0221.01", "TCGA.06.0237.01", "TCGA.06.0240.01",
"TCGA.08.0349.01", "TCGA.08.0380.01", "TCGA.08.0386.01", "TCGA.08.0520.01",
"TCGA.02.0007.01", "TCGA.02.0009.01", "TCGA.02.0016.01", "TCGA.02.0021.01",
"TCGA.02.0023.01", "TCGA.02.0027.01", "TCGA.02.0038.01", "TCGA.02.0043.01",
"TCGA.02.0070.01", "TCGA.02.0102.01", "TCGA.02.0260.01", "TCGA.02.0269.01",
"TCGA.02.0285.01", "TCGA.02.0289.01", "TCGA.02.0290.01", "TCGA.02.0317.01",
"TCGA.02.0333.01", "TCGA.02.0422.01", "TCGA.02.0430.01", "TCGA.06.0125.01",
"TCGA.06.0126.01", "TCGA.06.0137.01", "TCGA.06.0145.01", "TCGA.06.0148.01",
"TCGA.06.0187.01", "TCGA.06.0211.01", "TCGA.06.0402.01", "TCGA.08.0246.01",
"TCGA.08.0354.01", "TCGA.08.0355.01", "TCGA.08.0357.01", "TCGA.08.0358.01",
"TCGA.08.0375.01", "TCGA.08.0511.01", "TCGA.08.0514.01", "TCGA.08.0518.01",
"TCGA.08.0529.01", "TCGA.08.0531.01", "TCGA.02.0004.01", "TCGA.02.0025.01",
"TCGA.02.0033.01", "TCGA.02.0034.01", "TCGA.02.0039.01", "TCGA.02.0051.01",
"TCGA.02.0054.01", "TCGA.02.0057.01", "TCGA.02.0059.01", "TCGA.02.0064.01",
"TCGA.02.0075.01", "TCGA.02.0079.01", "TCGA.02.0085.01", "TCGA.02.0086.01",
"TCGA.02.0099.01", "TCGA.02.0106.01", "TCGA.02.0107.01", "TCGA.02.0111.01",
"TCGA.02.0326.01", "TCGA.02.0337.01", "TCGA.06.0122.01", "TCGA.06.0124.01",
"TCGA.06.0130.01", "TCGA.06.0139.01", "TCGA.06.0143.01", "TCGA.06.0147.01",
"TCGA.06.0149.01", "TCGA.06.0152.01", "TCGA.06.0154.01", "TCGA.06.0164.01",
"TCGA.06.0175.01", "TCGA.06.0176.01", "TCGA.06.0184.01", "TCGA.06.0189.01",
"TCGA.06.0190.01", "TCGA.06.0194.01", "TCGA.06.0197.01", "TCGA.06.0210.01",
"TCGA.06.0397.01", "TCGA.06.0409.01", "TCGA.06.0412.01", "TCGA.06.0644.01",
"TCGA.06.0645.01", "TCGA.08.0346.01", "TCGA.08.0352.01", "TCGA.08.0360.01",
"TCGA.08.0390.01", "TCGA.08.0392.01", "TCGA.08.0509.01", "TCGA.08.0510.01",
"TCGA.08.0512.01", "TCGA.08.0522.01", "TCGA.12.0619.01", "TCGA.12.0620.01",
"TCGA.02.0003.01", "TCGA.02.0010.01", "TCGA.02.0011.01", "TCGA.02.0014.01",
"TCGA.02.0024.01", "TCGA.02.0026.01", "TCGA.02.0028.01", "TCGA.02.0046.01",
"TCGA.02.0047.01", "TCGA.02.0048.01", "TCGA.02.0060.01", "TCGA.02.0069.01",
"TCGA.02.0074.01", "TCGA.02.0080.01", "TCGA.02.0084.01", "TCGA.02.0087.01",
"TCGA.02.0104.01", "TCGA.02.0114.01", "TCGA.02.0281.01", "TCGA.02.0321.01",
"TCGA.02.0325.01", "TCGA.02.0338.01", "TCGA.02.0339.01", "TCGA.02.0432.01",
"TCGA.02.0439.01", "TCGA.02.0440.01", "TCGA.02.0446.01", "TCGA.06.0128.01",
"TCGA.06.0129.01", "TCGA.06.0146.01", "TCGA.06.0156.01", "TCGA.06.0166.01",
"TCGA.06.0174.01", "TCGA.06.0177.01", "TCGA.06.0238.01", "TCGA.06.0241.01",
"TCGA.06.0410.01", "TCGA.06.0413.01", "TCGA.06.0414.01", "TCGA.06.0646.01",
"TCGA.06.0648.01", "TCGA.08.0245.01", "TCGA.08.0344.01", "TCGA.08.0347.01",
"TCGA.08.0348.01", "TCGA.08.0350.01", "TCGA.08.0353.01", "TCGA.08.0359.01",
"TCGA.08.0385.01", "TCGA.08.0517.01", "TCGA.08.0524.01", "TCGA.12.0616.01",
"TCGA.12.0618.01", "TCGA.02.0089.01", "TCGA.02.0113.01", "TCGA.02.0115.01",
"TCGA.02.0451.01", "TCGA.06.0132.01", "TCGA.06.0133.01", "TCGA.06.0138.01",
"TCGA.06.0160.01", "TCGA.06.0162.01", "TCGA.06.0167.01", "TCGA.06.0171.01",
"TCGA.06.0173.01", "TCGA.06.0179.01", "TCGA.06.0182.01", "TCGA.06.0185.01",
"TCGA.06.0195.01", "TCGA.06.0208.01", "TCGA.06.0214.01", "TCGA.06.0219.01",
"TCGA.06.0221.01", "TCGA.06.0237.01", "TCGA.06.0240.01", "TCGA.08.0349.01",
"TCGA.08.0380.01", "TCGA.08.0386.01", "TCGA.08.0520.01", "TCGA.02.0007.01",
"TCGA.02.0009.01", "TCGA.02.0016.01", "TCGA.02.0021.01", "TCGA.02.0023.01",
"TCGA.02.0027.01", "TCGA.02.0038.01", "TCGA.02.0043.01", "TCGA.02.0070.01",
"TCGA.02.0102.01", "TCGA.02.0260.01", "TCGA.02.0269.01", "TCGA.02.0285.01",
"TCGA.02.0289.01", "TCGA.02.0290.01", "TCGA.02.0317.01", "TCGA.02.0333.01",
"TCGA.02.0422.01", "TCGA.02.0430.01", "TCGA.06.0125.01", "TCGA.06.0126.01",
"TCGA.06.0137.01", "TCGA.06.0145.01", "TCGA.06.0148.01", "TCGA.06.0187.01",
"TCGA.06.0211.01", "TCGA.06.0402.01", "TCGA.08.0246.01", "TCGA.08.0354.01",
"TCGA.08.0355.01", "TCGA.08.0357.01", "TCGA.08.0358.01", "TCGA.08.0375.01",
"TCGA.08.0511.01", "TCGA.08.0514.01", "TCGA.08.0518.01", "TCGA.08.0529.01",
"TCGA.08.0531.01", "TCGA.02.0004.01", "TCGA.02.0025.01", "TCGA.02.0033.01",
"TCGA.02.0034.01", "TCGA.02.0039.01", "TCGA.02.0051.01", "TCGA.02.0054.01",
"TCGA.02.0057.01", "TCGA.02.0059.01", "TCGA.02.0064.01", "TCGA.02.0075.01",
"TCGA.02.0079.01", "TCGA.02.0085.01", "TCGA.02.0086.01", "TCGA.02.0099.01",
"TCGA.02.0106.01", "TCGA.02.0107.01", "TCGA.02.0111.01", "TCGA.02.0326.01",
"TCGA.02.0337.01", "TCGA.06.0122.01", "TCGA.06.0124.01", "TCGA.06.0130.01",
"TCGA.06.0139.01", "TCGA.06.0143.01", "TCGA.06.0147.01", "TCGA.06.0149.01",
"TCGA.06.0152.01", "TCGA.06.0154.01", "TCGA.06.0164.01", "TCGA.06.0175.01",
"TCGA.06.0176.01", "TCGA.06.0184.01", "TCGA.06.0189.01", "TCGA.06.0190.01",
"TCGA.06.0194.01", "TCGA.06.0197.01", "TCGA.06.0210.01", "TCGA.06.0397.01",
"TCGA.06.0409.01", "TCGA.06.0412.01", "TCGA.06.0644.01", "TCGA.06.0645.01",
"TCGA.08.0346.01", "TCGA.08.0352.01", "TCGA.08.0360.01", "TCGA.08.0390.01",
"TCGA.08.0392.01", "TCGA.08.0509.01", "TCGA.08.0510.01", "TCGA.08.0512.01",
"TCGA.08.0522.01", "TCGA.12.0619.01", "TCGA.12.0620.01"), class = "AsIs"),
variable = list("A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT", "A4GALT",
"A4GALT", "A4GALT", "A4GALT", "A4GALT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT",
"AASDHPPT", "AASDHPPT", "AASDHPPT", "AASDHPPT", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS", "AASS", "AASS", "AASS", "AASS", "AASS",
"AASS", "AASS"), value = c(5.276103, 5.35056, 5.37262,
4.916779, 5.255199, 4.830462, 5.618421, 4.994325, 5.362078,
4.87872, 5.281758, 5.060673, 5.032231, 5.048806, 4.839722,
4.923535, 4.763481, 5.25185, 4.607244, 4.874135, 5.183055,
4.715909, 4.752422, 4.832779, 4.955304, 4.839479, 4.674129,
4.959712, 5.174832, 4.914349, 5.047126, 4.813893, 4.898783,
4.629207, 5.452093, 4.803268, 4.63638, 4.566667, 4.707842,
5.183576, 5.222767, 4.795189, 5.157255, 5.040986, 4.882451,
5.099198, 4.906124, 5.324483, 4.897704, 4.721557, 4.560735,
5.285663, 5.019752, 5.10422, 4.963837, 5.191014, 4.839183,
5.111891, 5.230775, 5.253859, 5.020962, 5.028923, 4.789567,
4.994382, 5.110896, 4.659554, 4.697176, 4.844605, 4.818433,
5.121669, 4.76544, 4.914832, 5.319186, 4.696795, 5.451632,
4.77652, 5.679458, 5.072649, 4.841152, 5.280851, 5.123841,
4.795604, 5.110355, 4.765478, 5.001371, 5.43749, 4.889082,
4.972062, 5.327381, 4.721678, 5.012028, 4.796616, 5.040389,
5.066229, 4.78083, 5.220528, 4.665159, 4.61155, 5.199528,
5.041063, 4.914854, 5.186544, 4.758814, 5.136182, 4.901131,
4.615867, 5.038767, 5.000084, 5.130969, 4.942621, 4.965945,
4.753494, 4.656747, 4.772172, 4.766693, 4.751754, 4.75892,
5.4399, 5.237567, 5.418108, 5.566972, 4.921697, 5.089683,
5.472775, 5.370931, 4.69697, 5.253588, 5.00669, 4.73998,
4.919547, 4.867942, 5.071345, 4.847368, 5.176036, 4.961712,
5.060058, 4.952342, 4.911892, 4.893706, 4.935945, 4.823853,
4.699039, 4.779047, 5.286876, 5.412161, 5.052965, 4.75157,
4.918697, 5.070624, 5.095242, 4.693061, 4.84817, 4.724091,
5.017511, 5.163175, 4.752653, 5.006496, 4.697784, 4.748804,
4.942778, 5.220017, 5.117897, 5.280987, 5.05359, 4.976963,
4.888311, 4.568106, 4.570471, 4.958682, 4.868208, 5.006963,
7.410985, 7.925698, 8.717694, 8.831726, 8.685598, 8.98908,
7.535715, 7.330327, 8.309435, 9.471049, 7.838395, 9.301439,
9.629328, 9.153508, 8.748457, 8.49458, 9.74917, 9.507714,
8.531583, 9.499057, 8.947185, 9.551708, 8.223703, 9.323581,
9.017713, 9.406471, 9.148368, 9.520262, 9.696199, 8.886793,
9.55331, 9.187007, 9.655647, 8.787215, 8.614147, 9.614918,
8.756033, 9.477737, 8.548806, 8.876524, 9.352153, 8.58425,
9.513568, 9.331686, 9.497287, 8.929776, 9.000967, 8.924557,
9.226353, 9.294038, 9.489771, 8.402745, 9.710996, 9.243704,
9.259261, 9.788176, 8.755881, 9.438367, 9.103577, 9.47733,
10.362907, 8.379743, 10.153277, 9.543227, 9.449766, 9.41847,
9.259251, 9.356288, 9.262021, 9.90888, 9.353908, 7.826302,
8.15629, 8.833104, 8.645693, 8.927278, 8.580026, 9.453006,
7.413321, 8.5271, 8.033024, 9.322998, 8.215563, 8.377462,
7.952485, 8.944302, 8.604217, 8.922872, 9.788117, 8.468349,
9.316798, 8.462774, 8.82706, 7.146993, 8.843828, 8.290583,
9.257143, 9.116788, 9.440035, 9.121044, 8.446821, 8.781436,
8.609735, 9.27633, 9.211463, 8.838721, 9.139192, 8.332482,
8.088289, 9.111058, 7.394214, 9.184934, 8.926501, 9.298526,
8.840485, 8.554193, 8.894817, 8.204988, 7.11687, 7.687961,
6.019112, 8.716617, 8.062017, 8.704051, 8.477954, 7.44808,
8.883891, 9.077114, 7.255707, 9.071063, 8.712863, 9.412139,
9.27545, 8.996337, 8.084158, 7.210894, 8.958724, 9.036785,
9.321076, 8.049895, 8.869745, 8.232425, 8.231382, 7.84654,
7.992519, 8.821877, 8.730873, 9.553611, 8.495732, 7.924081,
9.162586, 9.085931, 9.051661, 8.623999, 9.236301, 9.101034,
8.314316, 8.627097, 8.801639, 8.646574, 8.701107, 8.91916,
9.140105, 8.231715, 7.906888, 8.697757, 8.438698, 9.398918,
8.426789, 8.293288, 8.233579, 4.852965, 4.039765, 4.955791,
4.394703, 4.646766, 5.537399, 4.76578, 4.556211, 3.946523,
6.610876, 4.718202, 5.457869, 6.416272, 6.318725, 6.141232,
5.823741, 5.083812, 6.169948, 5.844653, 5.002601, 5.424686,
4.702785, 5.385843, 5.122835, 5.959356, 4.762266, 5.091486,
5.229295, 6.274835, 5.507774, 5.21711, 4.732192, 5.04904,
5.434618, 5.268548, 4.895186, 4.621281, 5.101784, 5.412475,
5.640761, 5.096669, 5.614993, 5.183794, 5.526456, 5.270242,
4.787773, 5.577272, 5.268673, 5.198471, 5.986983, 4.581575,
5.243363, 5.120405, 5.818633, 5.719462, 6.032659, 5.121209,
4.587358, 5.077363, 4.612867, 4.390816, 4.245374, 4.306798,
4.714761, 5.507793, 4.853783, 5.284451, 5.23705, 5.615067,
6.113968, 5.935108, 4.711357, 4.746056, 5.481466, 4.018317,
5.491608, 5.348309, 6.29726, 5.104945, 3.659807, 4.212124,
7.382433, 4.759042, 5.477221, 4.721583, 3.461616, 4.661938,
6.248778, 6.444987, 6.518938, 6.250626, 5.591291, 5.105311,
5.738959, 6.351681, 5.69126, 5.70084, 6.256607, 6.444103,
6.366744, 5.123301, 6.220927, 6.075183, 5.602491, 5.554682,
5.615799, 5.34326, 5.618031, 5.276051, 5.859151, 5.44998,
6.798145, 5.47292, 4.80361, 6.091784, 6.033107, 5.562031,
5.133174, 5.22466, 5.17734, 4.922713, 4.829015, 5.025563,
4.593663, 4.064932, 5.064906, 6.291379, 6.052109, 5.356175,
5.382765, 5.796457, 6.200434, 5.502845, 5.238411, 4.906437,
5.679067, 4.960242, 4.87042, 6.252233, 4.538571, 4.256875,
5.722253, 4.89972, 5.56538, 5.162661, 5.063488, 4.892427,
5.821581, 4.791409, 5.561178, 5.582145, 5.360658, 4.722709,
5.044129, 5.785034, 5.582128, 5.122513, 6.6356, 4.989573,
5.224528, 5.62876, 5.733539, 5.572817, 5.382657, 4.872869,
5.529441, 5.942917, 4.518715, 5.507888, 5.20644, 5.306312
)), row.names = c(NA, 513L), class = "data.frame")
There are a total of 362349 rows and 3 columns in the melted dataframe.
Every time I run the following code using ggplot to plot a heatmap in R:
tdftanplot<-ggplot(data=tdftan1, mapping=aes(variable, Row.names , fill= value))
geom_tile()
tdftanplot
I face the same error (although the value is of class numeric and variable & Row.name is of class character):
Error in abs(x) : non-numeric argument to mathematical function
Is there something wrong with the melted dataframe? What should I do differently to get the heatmap?
CodePudding user response:
Your Row.names column is of class 'AsIs'. You need to change it to 'character'. In addition, the variable
column is a list so you'll need to change to 'character'.
library(tidyverse)
class(tdftan1$Row.names)
#> [1] "AsIs"
# now change
class(tdftan1$Row.names) <- 'character'
# also change variable from list to character
tdftan1 <- tdftan1 %>% mutate(variable = as.character(variable))
tdftanplot<-ggplot(data=tdftan1, mapping=aes(variable, Row.names , fill= value))
geom_tile()
tdftanplot
Created on 2022-06-18 by the reprex package (v2.0.1)