I want to add summary statistics in histogram plot made using ggplot2
. I am using the following code
#Loading the required packages
library(dplyr)
l
You need to split your data.frame:
p1+geom_table_npc(data=summ,label =split(summ,summ$variable),
npcx = 0.00, npcy = 1, hjust = 0, vjust = 1,size=2)
or nest the summary table you have:
summ <- summ %>% nest(data=-c(variable))
# A tibble: 4 x 2
variable data
>
1 Sepal.Length [1 × 9]
2 Sepal.Width [1 × 9]
3 Petal.Length [1 × 9]
4 Petal.Width [1 × 9]
p1+geom_table_npc(data = summ,label =summ$data,
,npcx = 0.00, npcy = 1, hjust = 0, vjust = 1)