Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ggplot2 ggmosaic错误消息:“列表”类型的默认方法未实现_Ggplot2_Mosaic Plot_Ggmosaic - Fatal编程技术网

Ggplot2 ggmosaic错误消息:“列表”类型的默认方法未实现

Ggplot2 ggmosaic错误消息:“列表”类型的默认方法未实现,ggplot2,mosaic-plot,ggmosaic,Ggplot2,Mosaic Plot,Ggmosaic,尝试使用ggmosaic创建热图时,我一直在is.finitex中得到错误:未为类型“list”实现默认方法 搜索该错误消息时,一个答案是该错误是因为is.infinite和is.finite函数未使用data.frames方法实现 即使是小插曲中的例子对我来说也是失败的 ggplot(data = NHANES) + geom_mosaic(aes(weight = Weight, x = product(SleepHrsNight), fill=factor(SleepHrsNight

尝试使用ggmosaic创建热图时,我一直在is.finitex中得到错误:未为类型“list”实现默认方法

搜索该错误消息时,一个答案是该错误是因为is.infinite和is.finite函数未使用data.frames方法实现

即使是小插曲中的例子对我来说也是失败的

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))
我的系统是Windows、RStudio、最新版本之前的R版本1和GGV 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"), 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"))
此代码未成功:

ggplot(diverse) +
  geom_mosaic(aes(weight = 1, x = product(JrAssoc, SrAssPtr), fill = Diversity))

感谢您的指导。

如果您只是以这种方式更新ggplot2库

devtools::install_github('cran/ggplot2')
你的问题应该解决


正如我的文章中提到的,作者正在努力解决这个问题。

Hi@lawyeR,我没有一个直截了当的答案。但在github上检查此线程:>devtools::install\u github'cran/ggplot2'安装失败:SSL CA证书路径有问题?访问权限?嗯。。。奇怪的您可以使用install\u github安装其他库吗?