我正在尝试通过分别在x和y轴上使用Age和Income并使用sum_loan作为填充来构建热图。
数据如下:
Age
Income
Personal.Loan
sum_loan
(20,30] (0,50] 0 0
(20,30] (50,100] 0 0
(20,30] (50,100] 1 3
(20,30] (100,150] 0 0
(20,30] (100,150] 1 18
(20,30] (150,200] 0 0
(20,30] (150,200] 1 18
(20,30] (200,250] 0 0
(30,40] (0,50] 0 0
(30,40] (50,100] 0 0
(30,40] (50,100] 1 4
(30,40] (100,150] 0 0
(30,40] (100,150] 1 36
(30,40] (150,200] 0 0
(30,40] (150,200] 1 35
(30,40] (200,250] 1 1
(40,50] (0,50] 0 0
(40,50] (50,100] 0 0
(40,50] (50,100] 1 8
(40,50] (100,150] 0 0
(40,50] (100,150] 1 29
(40,50] (150,200] 0 0
(40,50] (150,200] 1 40
(40,50] (200,250] 0 0
(40,50] (200,250] 1 2
(50,60] (0,50] 0 0
(50,60] (50,100] 0 0
(50,60] (50,100] 1 7
(50,60] (100,150] 0 0
(50,60] (100,150] 1 33
(50,60] (150,200] 0 0
(50,60] (150,200] 1 39
(60,70] (0,50] 0 0
(60,70] (50,100] 0 0
(60,70] (50,100] 1 4
(60,70] (100,150] 0 0
(60,70] (100,150] 1 13
(60,70] (150,200] 0 0
(60,70] (150,200] 1 19
ggplot(Loan)+
geom_tile(aes(Age, Income, fill = sum_loan))
但我得到的只是
“美学必须为长度1或与数据(39)相同:x, y”
任何帮助将不胜感激。