Change the legend labels

Code
starwars %>% 
  ggplot(aes(sex, height, fill = sex)) +
  geom_col() +
  theme_nice() +
  scale_fill_discrete(labels=c('F', 'H', 'M', "N", "Missing")) # or scale_color_discrete if generating the legend using "color" parameter instead of fill

Change the legend title

Code
starwars %>% 
  ggplot(aes(sex, height, fill = sex)) +
  geom_col() +
  theme_nice() +
  labs(fill = "Gender") # or "color =" if generating the legend using "color" parameter instead of fill