'using a boxplot in R

I am trying to make a density plot out of 4000 rows (height.values), with 4 different categories (height.ind). this is the code i used.

library(ggplot2)
    
plom %>% 
  ggplot(aes(x = height.values, color=height.ind)) +
  geom_density() +
  labs(title = "height alimony")

I am able to get a density plot but there are a lot of lines instead of the 4 i want.

enter image description here

Anyone has an idea to fix it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source