0
尽管已经使用了ggplot几次,但我很努力地解决这个问题。我想这将是最简单的解释是什么我想没有我的恶劣企图这样做,在使用ggplot,以下是相当难看太多,但它是最好的,我可以在此刻:(管理gidplot from`mids` object
require(mice)
impute <- mice(nhanes, seed = 101)
counts <- table(nhanes$hyp)
barplot(counts, main="hyp", xlab="observed")
x11()
counts <- table(complete(impute,1)$hyp)
barplot(counts, main="hyp", xlab="Imputation 1")
x11()
counts <- table(complete(impute,2)$hyp)
barplot(counts, main="hyp", xlab="Imputation 2")
x11()
counts <- table(complete(impute,3)$hyp)
barplot(counts, main="hyp", xlab="Imputation 3")
x11()
counts <- table(complete(impute,4)$hyp)
barplot(counts, main="hyp", xlab="Imputation 4")
x11()
counts <- table(complete(impute,5)$hyp)
barplot(counts, main="hyp", xlab="Imputation 5")
我想在ggplot中创建一个漂亮的图表,显示这些类型的barlot图 - 例如,6行中的一行,所有的图表都在y轴上具有相同的比例尺,以便可以轻松地进行比较。 ldt <-complete(impute,"long", include=TRUE)
然后melt(ldt, c(".imp",".id","hyp"))
但我只是不能工作后如何调用ggplot :(
请请注意,我的真实数据中有许多不同的变量,这仅适用于分类变量。我想我可以做出一个功能,然后运行,使用sapply
,但只能在分类列?但我不知道该怎么做!