2
出於某種原因,一個功能,當我做到以下幾點:創建使用GGPLOT2
Fruit <- c(rep("Apple",3),rep("Orange",5))
Bug <- c("worm","spider","spider","worm","worm","worm","worm","spider")
Numbers <- runif(8)
df <- data.frame(Fruit,Bug,Numbers)
對於係數計
bar.plot <- function(dat,j,c){
ggplot(dat, aes(j, ..count..)) +
geom_bar(aes(fill = c), position = "dodge")
}
bar.plot(df,Fruit,Bug)
我得到
Don't know how to automatically pick scale for object of type function. Defaulting to continuous
Error in eval(expr, envir, enclos) : object 'j' not found
我主要關注的是第二錯誤的線在eval中...任何人都知道爲什麼會發生這種情況?我有很多棒圖,所以這個功能會讓我的生活變得更輕鬆。