problem on the bar graph axis

Hi, I'm having a problem with the following code:

p1 <- df_titanic %>%
group_by(Sobrevivencia) %>% summarize(Total = n()) %>%
mutate(Total=Total/sum(Total)*100) %>%
ggplot(aes(x = "", y=Total, fill = factor(Sobrevivencia))) +
geom_bar(width = 1, stat = "identity") +
scale_y_continuous(breaks = seq(0, 1, .2),
label = percent)+
theme(axis.line = element_blank(),
plot.title = element_text(hjust=0.5)) +
labs(fill="class",
x=NULL,
y=NULL,
title="Pie Chart of class",
caption="Source: mpg")

The error is shown:

Error in check_breaks_labels(breaks, labels) : object 'percent' not found

How do I solve this problem??

You need to load the scales package first.

Problem solved, Martin.
Thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.