how to filter values in geom_bar graph( there are two many values in datasets I want to show only top 10 values)

ggplot(data= netflix_df)+geom_bar(mapping=aes(x=name,y= popularity),stat = "identity")

try this

netflix_df %>%
  top_n(10, popularity) %>%
  ggplot()+geom_bar(mapping=aes(x=name,y= popularity),stat = "identity")

Its working thanks👍 Connect with me I have facing many problems which I can't find online.

I have more question how to show values in descending order in geom_bar

Try this: x=fct_reorder(name, -popularity)

I'm stuck in another problem where I can't find correaltion between two variables

my code : netflix_df %>%

Error: Error in if ( stop("invalid 'use' argument") :
the condition has length > 1

Inappropriate use of %>%, try


When trying to knit this error shows