R bwplot轴值显示不正确
以下代码生成bwplot,但y轴上的值为1,2,3,4,5,而不是10,11,12,13,14。我怎样才能纠正这个问题R bwplot轴值显示不正确,r,lattice,bwplot,R,Lattice,Bwplot,以下代码生成bwplot,但y轴上的值为1,2,3,4,5,而不是10,11,12,13,14。我怎样才能纠正这个问题 library(lattice) test <- data.frame(c(rep(10,100),rep(11,100),rep(12,100),rep(13,100),rep(14,100)) ,c(rep(rnorm(n=500,mean=2,sd=1:3)))) names(test) <- c("a","b") bwplot(
library(lattice)
test <- data.frame(c(rep(10,100),rep(11,100),rep(12,100),rep(13,100),rep(14,100))
,c(rep(rnorm(n=500,mean=2,sd=1:3))))
names(test) <- c("a","b")
bwplot(a ~ b, test)
库(晶格)
testbwrot(格子)期望因子位于~的左侧。打印前显式转换
test$a = as.factor(test$a)
或(排除或)使用
看起来很像,您需要将列a转换为字符因子
test$a=as.factor(as.character(test$a))
bwplot(a~b, data=test)
列出用于bwclot
功能的软件包。
test$a=as.factor(as.character(test$a))
bwplot(a~b, data=test)