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 %>%
cor(y=vote_count,x=popularity,method="pearson")

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

Inappropriate use of %>%, try

cor(y=netflix_df$vote_count,x=netflix_df$popularity,method="pearson")


When trying to knit this error shows

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.