How to create graph in Rstudio with ggplot?

Asked

Viewed 128 times

1

I need to create a simple bar graph with data from a data frame. But I want to divide each bar of the graph into three.

For example: In the bar referring to the year 2000, I have to put three different values. This should be repeated by the year 2015. Soon six bars, and each one must be divided into three to put different values.

Was using

ggplot(data =  ) + 
  geom_bar(mapping = aes(x , fill ), position = "dodge")

this code, but I cannot mount the data frame that is read by the function.

I want a graphic according to the image.

inserir a descrição da imagem aqui

  • ggplot(data = diamonds, mapping = aes(x = cut, fill = color)) + geom_bar(position = "dodge").

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.