Tada
Tada

Reputation: 13

I can not show the barchart by ggplot2

I do not know why the following message appeared and can not proceed with the command operations. 'Error: 'decode_colour' is not an exported object from 'namespace:farver''

library(ggplot2)
library(ggsci)
x <- data.frame(
  sample = c("A1", "A2", "B1", "B2", "C1", "C2"),
  weight = c(0.32, 0.33, 0.21, 0.22, 0.37, 0.36)
)

g <- ggplot(x, aes(x = sample, y = weight, fill = sample))
g <- g + geom_bar(stat = "identity")
g <- g + scale_fill_nejm()
plot(g)

Thank you so much for considering this.

Upvotes: 1

Views: 512

Answers (1)

NicolasH2
NicolasH2

Reputation: 804

When I run your code it outputs the graph and no error appears. A similar problem was posted here, and running the code there also did not throw an error for me. farver seems to be imported by ggplot2 via scales. Try reinstalling any of those packages and maybe it will solve the issue.

Upvotes: 1

Related Questions