gpt4 book ai didi

r - vcd包: error in adding text in the cells的mosaic()函数

转载 作者:行者123 更新时间:2023-12-05 00:22:43 24 4
gpt4 key购买 nike

我使用 mosaic 创建了一个马赛克图vcd 中的函数包裹。现在我想使用 labeling_cells 添加一些注释.不幸的是,我收到一个错误。问题可能是它不是标准 Titanic例子...

library("grid"); library("vcd")
dataset <- read.table("http://bit.ly/1aJTI1C")

# prepare data for plot as a "Structured Contingency Table"
data1 <- structable(dauer ~ groesse + ort, dataset)

# basic plot
mosaic(data1,
# separate the two elements of the plot
split_vertical = c(T, T, F),

# put the names in the right places and adds boxes
labeling_args = list(tl_labels = TRUE,
tl_varnames = FALSE,
boxes = TRUE),
# grip remains open
pop=FALSE
)

enter image description here
# structure that matches plot, but it does not help
#match<-t(data1)

# try to add labels
labeling_cells(text = data1, clip = FALSE)(data1)

这导致:
# Error in ifelse(abbreviate_varnames, sapply(seq_along(dn), function(i) abbreviate(dn[i],  : 
# replacement has length zero
# In addition: Warning message:
# In rep(no, length.out = length(ans)) :
# 'x' is NULL so the result will be NULL

我遇到的另一个问题是盒子不适合标签。如果您对此有任何提示,也请告诉我!

这是我在这里的第一个问题,所以请原谅潜在的错误!

非常感谢!

最佳答案

在 vcd 1.4-4 中修复了上游,但请注意,您可以简单地使用

mosaic(data1, labeling = labeling_values)

关于r - vcd包: error in adding text in the cells的mosaic()函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29516504/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com