nan.xiao
我尝试您的方法 好像不能解决
可以给我一点提示吗?
谢谢您
`### cars {.tabset}
makeplot<-function(object) {
b = as.factor(object$vs)
d <- list()
for(i in seq(NCOL(object))) {
if (is.factor(object[[i]])) {
d[[i]] <- object%>%
group_by(object[i], b)%>%
tally()
a[[i]]<-ggplot(data = d[[i]], aes_string(y = "n", x = "b", fill = names(object[i]))) +
geom_col(position = "dodge")
}
else{
a[[i]] <- ggplot(data = object, aes_string(y = names(object)[i], x = b))
a[[i]] <- a[[i]] + geom_boxplot()
}
}
return(a)
}
makeplot(mtcars)
````