Selecting Data within a variable

I am very new to R, so please do forgive me if this question has been asked before

This is my data set - https://www.kaggle.com/zynicide/wine-reviews

Inside this, there is a variable called country. I have made this variable into a category using as.factor

This gives me x = countries and freq. But I have 47 countries. I want only those whose frequency is above 1000.

wine$country <- as.factor(wine$country)
countries <- wine$country
count(countries)
plot(countries, xlab = "Countries", ylab = "Frequency")

How do I select from countries whose frequency is over 1000 and subset it into a new variable?

Thanks

is that the count function from dplyr or another package ?
I don't understand how it wouldnt error as dplyr count doesnt support raw factors as parameters, rather it can be passed dataframes/tibbles...

Hey,

The count function is from plyr package

Thanks

oh, thanks. well dplyr is used for general dataframe manipulation. i.e.

plyr::count(iris$Sepal.Length) %>%
  dplyr::filter(freq > 8)

not sure about what it means to 'subset into a new variable',
if you mean assign the result, then that would be <- which you have experience using.
Please let me know if you mean something else.

I think what I was trying to say is what you have written.

From the results that I get, I want to choose only those that freq > 1000.

So when I do plyr::count(countries), I get 47 countries. But I want to choose maybe 8 which has a freq > 1000.
The second part is where I don't understand how to choose results within results.

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.