搜索该错误消息,一个答案是此错误是因为is.infinite()和is.finite()函数未使用data.frames方法实现."在问题或关于ggmosaic方面不是有用的解决方案 即使小插图中的示例对我来说也失败了. ggplot(data = NHANES)+geom_mosaic(aes(重量=重量,x =产品(SleepHrsNight),fill = factor(SleepHrsNight)),na.rm = TRUE)+实验室(x =一小时的睡眠时间",title ="f(SleepHrsNight)")+指南(fill = guide_legend(title ="SleepHrsNight",reverse = TRUE)) 我的系统是Windows,RStudio,最新版本之前的R版本以及 ggmosaic Ver 0.1.2 我要使用的虚构数据框是 structure(list(Diversity = structure(c(1L,5L,4L,5L,1L,2L,2L,2L,4L,1L,5L,4L,5L,4L,2L,3L,3L,1L,5L,2L,1L,4L,3L,3L,3L),. Label = c("AfricanAm","Asian","Cauc.","Latino","Other"),类别="factor"),Office =结构(c(1L,2L,1L,3L,4L,5L,2L,4L,5L,3L,4L,4L,1L,2L,3L,4L,1L,5L,5L,1L,2L,3L,2L,3L,5L)、. Label = c("Hamlet","MainTown","Metroprole","Smithville","Urbanburg"),类="factor"),JrAssoc = c(1,1,1,1,1,1,2,2,2,2,4,4,1,1,1,2,2,3,3,3,5,5,2,5,9,10),SrAssPtr = c(2,2,1,1,1,3,2,1,4,4,4,1,1,1,3,5,7,3,2,1,1,1,1,1,2,3,4,4)),row.names = c(NA,-25L),.names = c("Diversity","Office","JrAssoc","SrAssPtr"),类别= c("tbl_df","tbl","data.frame")) 此代码未成功 ggplot(多样化)+geom_mosaic(aes(权重= 1,x =产品(JrAssoc,SrAssPtr),填充=分集)) 谢谢您的指导.解决方案如果您只是以这种方式更新ggplot2库 devtools :: install_github('cran/ggplot2') 您的问题应该得到解决.正如我的评论所述,作者正在尝试解决此问题./p>Trying to create a heatmap using ggmosaic, I keep getting the error Error in is.finite(x) : default method not implemented for type 'list'Searching for that error message, one answer was that "This error is because the is.infinite() and the is.finite() functions are not implemented with a method for data.frames." But not a useful solution in the question nor about ggmosaicEven the example from the vignette fails for me.ggplot(data = NHANES) + geom_mosaic(aes(weight = Weight, x = product(SleepHrsNight), fill=factor(SleepHrsNight)), na.rm=TRUE) + labs(x="Hours of sleep a night ", title='f(SleepHrsNight)') + guides(fill=guide_legend(title = "SleepHrsNight", reverse = TRUE))My system is Windows, RStudio, R version one before the most current, and ggmosaic Ver 0.1.2The made-up data frame I want to use isstructure(list(Diversity = structure(c(1L, 5L, 4L, 5L, 1L, 2L,2L, 2L, 4L, 1L, 5L, 4L, 5L, 4L, 2L, 3L, 3L, 1L, 5L, 2L, 1L, 4L,3L, 3L, 3L), .Label = c("AfricanAm", "Asian", "Cauc.", "Latino","Other"), class = "factor"), Office = structure(c(1L, 2L, 1L,3L, 4L, 5L, 2L, 4L, 5L, 3L, 4L, 4L, 1L, 2L, 3L, 4L, 1L, 5L, 5L,1L, 2L, 3L, 2L, 3L, 5L), .Label = c("Hamlet", "MainTown", "Metroprole","Smithville", "Urbanburg"), class = "factor"), JrAssoc = c(1,1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 1, 1, 1, 2, 2, 3, 3, 3, 5, 5, 2,5, 9, 10), SrAssPtr = c(2, 2, 1, 1, 3, 2, 1, 4, 4, 5, 1, 1, 3,5, 7, 3, 2, 1, 1, 1, 1, 2, 3, 4, 4)), row.names = c(NA, -25L), .Names = c("Diversity","Office", "JrAssoc", "SrAssPtr"), class = c("tbl_df", "tbl","data.frame"))This code has not succeeded:ggplot(diverse) + geom_mosaic(aes(weight = 1, x = product(JrAssoc, SrAssPtr), fill = Diversity))Thank you for any guidance. 解决方案 If you just update your ggplot2 library in this waydevtools::install_github('cran/ggplot2')your problem should be solved.As mentioned in my comments, author are trying to fix the issue. 这篇关于ggmosaic错误消息:类型'列表'未实现默认方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 阿里云证书,YYDS! 05-23 08:29