无法从仪表板中的数据透视表绘制热图

时间:2019-11-20 18:02:45

标签: r shinydashboard flexdashboard

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
Apartment_no <- c("1-SV","1-SV","1-SV","1-SH","1-SH","1-SH","1-1V","1-1V","1-1V","1-1H","1-1H","1-1H","3-SV","3-SV","3-SV","3-1V","3-1V","3-1V","3-1H","3-1H","3-1H")
month <- c("September","October","November","September","October","November","September","October","November","September","October","November","September","October","November","September","October","November","September","October","November")
Days <- c("2","19","28","2","19","28","2","19","28","2","19","28","25","31","28","12","13","24","8","26","19")
Heat_data <- data.frame(Apartment_no,month,Days)

我必须在以下数据上使用数据透视表创建一个热图,数据实际上在所有月份中都有163套公寓和数据,但这只是仪表板中的示例数据,我正在使用以下代码。但它向我返回了错误。

rpivotTable(Heat_clean,aggregatorName = "Days",cols = "Month",rows = "Apartment_no",rendererName = "Heatmap")

我希望它会产生可以在图像中看到的东西。我希望我的行作为Apartment_no,列作为月份,而Days作为其之间的数据。I want it to look something like this.

但是使用上面的代码,我得到的东西可以在图中看到。Something that I am getting.

0 个答案:

没有答案