我试图使用sjPlot包运行这段代码..。
library(sjPlot)
likert_6 <- data.frame(as.factor(sample(1:6, 500, replace=T, prob=c(0.2,0.1,0.1,0.3,0.2,0.1))),
as.factor(sample(1:6, 500, replace=T, prob=c(0.15,0.15,0.3,0.1,0.1,0.2))),
as.factor(sample(1:6, 500, replace=T, prob=c(0.2,0.25,0.05,0.2,0.2,0.2))),
as.factor(sample(1:6, 500, replace=T, prob=c(0.2,0.1,0.1,0.4,0.1,0.1))),
as.factor(sample(1:6, 500, replace=T, prob=c(0.1,0.4,0.1,0.3,0.05,0.15))))
levels_6 <- list(c("Very strongly disagree", "Strongly disagree", "Disagree", "Agree", "Strongly Agree", "Very strongly agree"))
items <- list(c("Q1", "Q2", "Q3", "Q4", "Q5"))
sjp.likert(likert_6, legendLabels=levels_6, barColor="red", axisLabels.x=items, orderBy="pos")包已正确安装,但我得到了以下错误:
Error in sjp.likert(likert_6, legendLabels = levels_6, barColor = "red", :
could not find function "sjp.likert"在运行此代码/包时,是否还有其他人有此问题?我从来没有使用过它,并检查了网站的具体说明。
发布于 2020-02-21 16:28:48
(也许应该只是一个评论,但似乎很长)
我最好的猜测是,您正在查看的文档与已安装的包的版本之间存在不匹配。我可以在网上找到用于这份文件函数的sjp.likert()函数,但这是用于2.4.1包的;当前版本的包(2.8.2)有plot_likert,但没有sjp.likert()。你是在仿效一个老榜样吗?
sjp.likert()被重命名为plot_likert()。
版本2.6.0 (似乎已于2018年发布)。
https://stackoverflow.com/questions/60342485
复制相似问题