What does stat means in ggplot?

r
ggplot2

#1

I am currently studying about visualisation in R using ggplot2 packages while studying it I came across a code in which plotting is done with the help of ggplot.

library(ggplot2)
intl = read.csv("intl.csv")
str(intl)
ggplot(intl, aes(x=Region, y=PercentOfIntl)) +
  geom_bar(stat="identity") +
  geom_text(aes(label=PercentOfIntl))

I want to know what does stat means in the code.


#2

hello @harry,

1.Plotting the store_counts which is a column in a dataset:

ggplot(data = store_type_agg, aes(x = store_type,y = store_type_count,fill = store_type))+
                                            geom_bar(stat = "identity")

This gives a plot in which the y variable is a column in the dataset.

2.We use stat = “bin” when the variable is not a column in the dataset:

ggplot(data = store_sales,aes(store_type,fill = store_type))+geom_bar(stat = “bin”)

Default is count data when you set stat = “bin”

Hope this helps!!