Error in n > 1 : comparison (6) is possible only for atomic and list types

I run this code
light_data1%>%
count(cname,iso_n,year,lrgdpchWB,isocode)%>%
filter(n>1)
--> this work. However, when I replace light_data1=steel_data6, It can't work
steel_data6%>%
count(Country code,cname,year,Apparent consumption of crude steel)%>%
filter(n>1)

And I faced this error:
Error: unexpected symbol in:
"steel_data6%>%
count(Country code"

filter(n>1)
Error in n > 1 :
comparison (6) is possible only for atomic and list types

Could you please help me?

Try

suppressPackageStartupMessages({
  library(dplyr)
})
mtcars %>%
  group_by(gear) %>% 
  count() %>%
  filter(n > 5)
#> # A tibble: 2 x 2
#> # Groups:   gear [2]
#>    gear     n
#>   <dbl> <int>
#> 1     3    15
#> 2     4    12

Created on 2020-12-03 by the reprex package (v0.3.0.9001)

Thank you. It still doesnt work.

I have no visibility into why your data frame is different in the absence of a reprex

This is the whole code that I used :slight_smile:

steel_data <-read.csv("STEEL_database_2012.csv",header=T,",")
steel_data1<-as_tibble(steel_data)
colnames(steel_data1) <- as.character(unlist(steel_data1[1,]))
steel_data1 = steel_data1[-1, ]
steel_data2<-steel_data1%>%
pivot_longer(cols=c('1970','1971','1972','1973','1974','1975','1976','1977','1978','1979','1980','1981','1982','1983','1984','1985','1986','1987','1988','1989','1990','1991','1992','1993','1994','1995','1996','1997','1998','1999','2000','2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012'),names_to="year",values_to="Apparent consumption of crude steel",values_drop_na=TRUE)
rename(steel_data2,cname=t)
as.numeric(steel_data2$year)
steel_data3<-steel_data2%>%
filter(year>1991)
steel_data4<-steel_data3%>%
filter(year<2011)
steel_data5<-rename(steel_data4,cname=t)
steel_data6<-as.data.frame(steel_data5)

str(steel_data6)
steel_data6%>%
count(Country code,cname,year,Apparent consumption of crude steel)%>%
filter(n>1)

That's part way there, but I still can't really see steel_data6 or its representative substitute. In an R session use

dput(steel_data6)

and cut and paste enough lines of the output into an answer.

"Belgium/Luxemburg", "Belgium/Luxemburg", "Belgium/Luxemburg", 
"Belgium/Luxemburg", "Belgium/Luxemburg", "Belgium/Luxemburg", 
"Belgium/Luxemburg", "Belgium/Luxemburg", "Belgium/Luxemburg", 
"Belgium/Luxemburg", "Belgium/Luxemburg", "Belgium/Luxemburg", 
"Belgium/Luxemburg", "Belgium/Luxemburg", "Belgium/Luxemburg", 
"Belgium/Luxemburg", "Belgium/Luxemburg", "Bangladesh", "Bangladesh", 
"Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", 
"Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", 
"Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", 
"Bangladesh", "Bangladesh", "Bolivia", "Bolivia", "Bolivia", 
"Bolivia", "Bolivia", "Bolivia", "Bolivia", "Bolivia", "Bolivia", 
"Bolivia", "Bolivia", "Bolivia", "Bolivia", "Bolivia", "Bolivia", 
"Bolivia", "Bolivia", "Bolivia", "Bolivia", "Brazil", "Brazil", 
"Brazil", "Brazil", "Brazil", "Brazil", "Brazil", "Brazil", "Brazil", 
"Brazil", "Brazil", "Brazil", "Brazil", "Brazil", "Brazil", "Brazil", 
"Brazil", "Brazil", "Brazil", "Bulgaria", "Bulgaria", "Bulgaria", 
"Bulgaria", "Bulgaria", "Bulgaria", "Bulgaria", "Bulgaria", "Bulgaria", 
"Bulgaria", "Bulgaria", "Bulgaria", "Bulgaria", "Bulgaria", "Bulgaria", 
"Bulgaria", "Bulgaria", "Bulgaria", "Bulgaria", "Myanmar", "Myanmar", 
"Myanmar", "Myanmar", "Myanmar", "Myanmar", "Myanmar", "Myanmar", 
"Myanmar", "Myanmar", "Myanmar", "Myanmar", "Myanmar", "Myanmar", 
"Myanmar", "Myanmar", "Myanmar", "Myanmar", "Myanmar", "Cameroon", 
"Cameroon", "Cameroon", "Cameroon", "Cameroon", "Cameroon", "Cameroon", 
"Cameroon", "Cameroon", "Cameroon", "Cameroon", "Cameroon", "Cameroon", 
"Cameroon", "Cameroon", "Cameroon", "Cameroon", "Cameroon", "Cameroon", 
"Canada", "Canada", "Canada", "Canada", "Canada", "Canada", "Canada", 
"Canada", "Canada", "Canada", "Canada", "Canada", "Canada", "Canada", 
"Canada", "Canada", "Canada", "Canada", "Canada", "Sri Lanka", 
"Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka", 
"Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka", 
"Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka", 
"Sri Lanka", "Sri Lanka", "Sri Lanka", "Chile", "Chile", "Chile", 
"Chile", "Chile", "Chile", "Chile", "Chile", "Chile", "Chile", 
"Chile", "Chile", "Chile", "Chile", "Chile", "Chile", "Chile", 

"France", "France", "France", "France", "France", "France", "France", 
"France", "France", "France", "France", "France", "France", "France", 
"France", "France", "Georgia", "Georgia", "Georgia", "Georgia", 
"Georgia", "Georgia", "Georgia", "Georgia", "Georgia", "Georgia", 
"Georgia", "Georgia", "Georgia", "Georgia", "Georgia", "Georgia", 
"Germany", "Germany", "Germany", "Germany", "Germany", "Germany", 
"Germany", "Germany", "Germany", "Germany", "Germany", "Germany", 
"Germany", "Germany", "Germany", "Germany", "Germany", "Germany", 
"Germany", "Bosnia-Herzegovina", "Bosnia-Herzegovina", "Bosnia-Herzegovina", 
"Bosnia-Herzegovina", "Bosnia-Herzegovina", "Bosnia-Herzegovina", 
"Bosnia-Herzegovina", "Bosnia-Herzegovina", "Bosnia-Herzegovina", 
"Bosnia-Herzegovina", "Bosnia-Herzegovina", "Bosnia-Herzegovina", 
"Bosnia-Herzegovina", "Bosnia-Herzegovina", "Bosnia-Herzegovina", 
"Bosnia-Herzegovina", "Bosnia-Herzegovina", "Bosnia-Herzegovina", 
"Ghana", "Ghana", "Ghana", "Ghana", "Ghana", "Ghana", "Ghana", 
"Ghana", "Ghana", "Ghana", "Ghana", "Ghana", "Ghana", "Ghana", 
"Ghana", "Ghana", "Ghana", "Ghana", "Ghana", "Greece", "Greece", 
"Greece", "Greece", "Greece", "Greece", "Greece", "Greece", "Greece", 
"Greece", "Greece", "Greece", "Greece", "Greece", "Greece", "Greece", 

"Hungary", "Hungary", "Hungary", "Hungary", "Hungary", "Hungary", 
"Hungary", "Hungary", "Hungary", "Hungary", "Hungary", "Croatia", 
"Croatia", "Croatia", "Croatia", "Croatia", "Croatia", "Croatia", 
"Croatia", "Croatia", "Croatia", "Croatia", "Croatia", "Croatia", 
"Croatia", "Croatia", "Croatia", "Croatia", "Croatia", "Croatia", 
"Iceland", "Iceland", "Iceland", "Iceland", "Iceland", "Iceland", 
"Iceland", "Iceland", "Iceland", "Iceland", "Iceland", "Iceland", 
"Iceland", "Iceland", "Iceland", "Iceland", "Iceland", "Iceland", 
"Iceland", "India", "India", "India", "India", "India", "India", 
"India", "India", "India", "India", "India", "India", "India", 
"India", "India", "India", "India", "India", "India", "Indonesia", 
"Indonesia", "Indonesia", "Indonesia", "Indonesia", "Indonesia", 
"Indonesia", "Indonesia", "Indonesia", "Indonesia", "Indonesia", 
"Indonesia", "Indonesia", "Indonesia", "Indonesia", "Indonesia", 
"Indonesia", "Indonesia", "Indonesia", "Iran", "Iran", "Iran", 
"Iran", "Iran", "Iran", "Iran", "Iran", "Iran", "Iran", "Iran", 
"Iran", "Iran", "Iran", "Iran", "Iran", "Iran", "Iran", "Iran", 
"Ireland", "Ireland", "Ireland", "Ireland", "Ireland", "Ireland", 
"Ireland", "Ireland", "Ireland", "Ireland", "Ireland", "Ireland", 
"Ireland", "Ireland", "Ireland", "Ireland", "Ireland", "Ireland", 
"Ireland", "Israel", "Israel", "Israel", "Israel", "Israel", 
"Israel", "Israel", "Israel", "Israel", "Israel", "Israel", "Israel", 
"Israel", "Israel", "Israel", "Israel", "Israel", "Israel", "Israel", 
"Italy", "Italy", "Italy", "Italy", "Italy", "Italy", "Italy", 
"Italy", "Italy", "Italy", "Italy", "Italy", "Italy", "Italy", 
"Italy", "Italy", "Italy", "Italy", "Italy", "Ivory Coast", "Ivory Coast", 
"Ivory Coast", "Ivory Coast", "Ivory Coast", "Ivory Coast", "Ivory Coast", 
"Ivory Coast", "Ivory Coast", "Ivory Coast", "Ivory Coast", "Ivory Coast", 
"Ivory Coast", "Ivory Coast", "Ivory Coast", "Ivory Coast", "Ivory Coast", 
"Ivory Coast", "Ivory Coast", "Kazakhstan", "Kazakhstan", "Kazakhstan", 
"Kazakhstan", "Kazakhstan", "Kazakhstan", "Kazakhstan", "Kazakhstan", 
"Kazakhstan", "Kazakhstan", "Kazakhstan", "Kazakhstan", "Kazakhstan", 
"Kazakhstan", "Kazakhstan", "Kazakhstan", "Kazakhstan", "Kazakhstan", 
"Kazakhstan", "Jamaica", "Jamaica", "Jamaica", "Jamaica", "Jamaica", 
"Jamaica", "Jamaica", "Jamaica", "Japan", "Japan", "Japan", "Japan", 
"Japan", 
"Malta", "Malta", "Malta", "Malta", "Malta", "Malta", "Malta", 
"Malta", "Malta", "Malta", "Malta", "Malta", "Malta", "Malta", 
"Malta", "Malta", "Malta", "Malta", "Malta", "Mexico", "Mexico", 
"Mexico", "Mexico", "Mexico", "Mexico", "Mexico", "Mexico", "Mexico", 
"Mexico", "Mexico", "Mexico", "Mexico", "Mexico", "Mexico", "Mexico", 
"Mexico", "Mexico", "Mexico", "Morocco", "Morocco", "Morocco", 
"Morocco", "Morocco", "Morocco", "Morocco", "Morocco", "Morocco", 
"Morocco", "Morocco", "Morocco", "Morocco", "Morocco", "Morocco", 
"Morocco", "Morocco", "Morocco", "Morocco", "Moldova", "Moldova", 
"Moldova", "Moldova", "Moldova", "Moldova", "Moldova", "Moldova", 
"Moldova", "Moldova", "Moldova", "Moldova", "Moldova", "Moldova", 
"Moldova", "Moldova", "Moldova", "Moldova", "Netherlands", "Netherlands", 
"Netherlands", "Netherlands", "Netherlands", "Netherlands", "Netherlands", 
"Netherlands", "Netherlands", "Netherlands", "Netherlands", "Netherlands", 
"Netherlands", "Netherlands", "Netherlands", "Netherlands", "Netherlands", 
"Netherlands", "Netherlands", "Macedonia", "Macedonia", "Macedonia", 
"Macedonia", "Macedonia", "Macedonia", "Macedonia", "Macedonia", 
"Macedonia", "Macedonia", "Macedonia", "Macedonia", "Macedonia", 
"Macedonia", "Macedonia", "Macedonia", "Macedonia", "New Zealand", 
"New Zealand", "New Zealand", "New Zealand", "New Zealand", "New Zealand", 
"New Zealand", "New Zealand", "New Zealand", "New Zealand", "New Zealand", 
"New Zealand", "New Zealand", "New Zealand", "New Zealand", "New Zealand", 
"New Zealand", "New Zealand", "New Zealand", "Nicaragua", "Nicaragua", 
"Nicaragua", "Nicaragua", "Nicaragua", "Nicaragua", "Nicaragua", 
"Nicaragua", "Nicaragua", "Nicaragua", "Nicaragua", "Nicaragua", 
"Nicaragua", "Nicaragua", "Nicaragua", "Nicaragua", "Nicaragua", 
"Nicaragua", "Nicaragua", "Nigeria", "Nigeria", "Nigeria", "Nigeria", 
"Nigeria", "Nigeria", "Nigeria", "Nigeria", "Nigeria", "Nigeria", 
"Nigeria", "Nigeria", "Nigeria", "Nigeria", "Nigeria", "Nigeria", 
"Nigeria", "Nigeria", "Nigeria", "Norway", "Norway", "Norway", 
"Norway", "Norway", "Norway", "Norway", "Norway", "Norway", "Norway", 
"Norway", "Norway", "Norway", "Norway", "Norway", "Norway", "Norway", 
"Norway", "Norway", "Pakistan", "Pakistan", "Pakistan", "Pakistan", 
"Pakistan", "Pakistan", "Pakistan", "Pakistan", "Pakistan", "Pakistan", 
"Pakistan", "Pakistan", "Pakistan", "Pakistan", "Pakistan", "Pakistan", 
"Pakistan", "Pakistan", "Pakistan", "Panama", "Panama", "Panama", 
"Panama", "Panama", "Panama", "Panama", "Panama", "Panama", "Panama", 
"Panama", "Panama", "Panama", "Panama", "Panama", "Panama", "Panama", 
"Panama", "Panama", "Czech republic", "Czech republic", "Czech republic", 
"Czech republic", "Czech republic", "Czech republic", "Czech republic", 
"Czech republic", "Czech republic", "Czech republic", "Czech republic", 
"Czech republic", "Czech republic", "Czech republic", "Czech republic", 
"Czech republic", "Czech republic", "Czech republic", "Czech republic", 
"Paraguay", "Paraguay", "Paraguay", "Paraguay", "Paraguay", "Paraguay", 
"Paraguay", "Paraguay", "Paraguay", "Paraguay", "Paraguay", "Paraguay", 
"Paraguay", "Paraguay", "Paraguay", "Paraguay", "Paraguay", "Paraguay", 
"Paraguay", "Peru", "Peru", "Peru", "Peru", "Peru", "Peru", "Peru", 
"Peru", "Peru", "Peru", "Peru", "Peru", "Peru", "Peru", "Peru", 
"Peru", "Peru", "Peru", "Peru", "Philippines", "Philippines", 
"Philippines", "Philippines", "Philippines", "Philippines", "Philippines", 
"Philippines", "Philippines", "Philippines", "Philippines", "Philippines", 
"Philippines", "Philippines", "Philippines", "Philippines", "Philippines", 
"Philippines", "Philippines", "Poland", "Poland", "Poland", "Poland", 
"Poland", "Poland", "Poland", "Poland", "Poland", "Poland", "Poland", 
"Poland", "Poland", "Poland", "Poland", "Poland", "Poland", "Poland", 
"Poland", "Portugal", "Portugal", "Portugal", "Portugal", "Portugal", 
"Portugal", "Portugal", "Portugal", "Portugal", "Portugal", "Portugal", 
"Portugal", "Portugal", "Portugal", "Portugal", "Portugal", "Portugal", 
"Portugal", "Portugal", "Qatar", "Qatar", "Qatar", "Qatar", "Qatar", 
"Qatar", "Qatar", "Qatar", "Qatar", "Qatar", "Qatar", "Qatar", 
"Qatar", "Qatar", "Qatar", "Qatar", "Qatar", "Qatar", "Qatar", 
"Romania", "Romania", "Romania", "Romania", "Romania", "Romania", 
"Romania", "Romania", "Romania", "Romania", "Romania", "Romania", 
"Romania", "Romania", "Romania", "Romania", "Romania", "Romania", 
"Romania", "Russia", "Russia", "Russia", "Russia", "Russia", 
"Russia", "Russia", "Russia", "Russia", "Russia", "Russia", "Russia", 
"Russia", "Russia", "Russia", "Russia", "Russia", "Russia", "Russia", 
"Yugoslavia", "Yugoslavia", "Yugoslavia", "Yugoslavia", "Yugoslavia", 
"Yugoslavia", "Yugoslavia", "Yugoslavia", "Yugoslavia", "Yugoslavia", 
"Yugoslavia", "Yugoslavia", "Yugoslavia", "Yugoslavia", "Yugoslavia", 
"Yugoslavia", "Yugoslavia", "Yugoslavia", "Yugoslavia", "Saudi Arabia", 
"Saudi Arabia", "Saudi Arabia", "Saudi Arabia", "Saudi Arabia", 
, 
"Senegal", "Senegal", "Senegal", "Senegal", "Slovenia", "Slovenia", 
"Slovenia", "Slovenia", "Slovenia", "Slovenia", "Slovenia", "Slovenia", 
"Slovenia", "Slovenia", "Slovenia", "Slovenia", "Slovenia", "Slovenia", 
"Slovenia", "Slovenia", "Slovenia", "Slovenia", "Slovenia", "Slovak Republic", 
"Slovak Republic", "Slovak Republic", "Slovak Republic", "Slovak Republic", 
"Slovak Republic", "Slovak Republic", "Slovak Republic", "Slovak Republic", 
"Slovak Republic", "Slovak Republic", "Slovak Republic", "Slovak Republic", 
"Slovak Republic", "Slovak Republic", "Slovak Republic", "Slovak Republic", 
"Slovak Republic", "Slovak Republic", "Singapore", "Singapore", 
"Singapore", "Singapore", "Singapore", "Singapore", "Singapore", 
"Singapore", "Singapore", "Singapore", "Singapore", "Singapore", 
"Singapore", "Singapore", "Singapore", "Singapore", "Singapore", 
"Singapore", "Singapore", "South Africa", "South Africa", "South Africa", 
"South Africa", "South Africa", "South Africa", "South Africa", 
"South Africa", "South Africa", "South Africa", "South Africa", 
"South Africa", "South Africa", "South Africa", "South Africa", 
"South Africa", "South Africa", "South Africa", "South Africa", 
"Spain", "Spain", "Spain", "Spain", "Spain", "Spain", "Spain", 
"Spain", "Spain", "Spain", "Spain", "Spain", "Spain", "Spain", 
"Spain", "Spain", "Spain", "Spain", "Spain", "Sudan", "Sudan", 
"Sudan", "Sudan", "Sudan", "Sudan", "Sudan", "Sudan", "Sudan", 
"Sudan", "Sudan", "Sudan", "Sudan", "Sudan", "Sudan", "Sudan", 
"Sudan", "Sudan", "Sudan", "Sweden", "Sweden", "Sweden", "Sweden", 
"Sweden", "Sweden", "Sweden", "Sweden", "Sweden", "Sweden", "Sweden", 
"Sweden", "Sweden", "Sweden", "Sweden", "Sweden", "Sweden", "Sweden", 
"Sweden", "Switzerland", "Switzerland", "Switzerland", "Switzerland", 
"Switzerland", "Switzerland", "Switzerland", "Switzerland", "Switzerland", 
"Switzerland", "Switzerland", "Switzerland", "Switzerland", "Switzerland", 
"Switzerland", "Switzerland", "Switzerland", "Switzerland", "Switzerland", 
"Syria", "Syria", "Syria", "Syria", "Syria", "Syria", "Syria", 
"Syria", "Syria", "Syria", "Syria", "Syria", "Syria", "Syria", 
"Syria", "Syria", "Syria", "Syria", "Syria", "Taiwan", "Taiwan", 
"Taiwan", "Taiwan", "Taiwan", "Taiwan", "Taiwan", "Taiwan", "Taiwan", 
"Taiwan", "Taiwan", "Taiwan", "Taiwan", "Taiwan", "Taiwan", "Taiwan", 
"Taiwan", "Taiwan", "Taiwan", "Tanzania", "Tanzania", "Tanzania", 
"Tanzania", "Tanzania", "Tanzania", "Tanzania", "Tanzania", "Tanzania", 
"Tanzania", "Tanzania", "Tanzania", "Tanzania", "Tanzania", "Tanzania", 
"Tanzania", "Tanzania", "Tanzania", "Tanzania", "Thailand", "Thailand", 
"Thailand", "Thailand", "Thailand", "Thailand", "Thailand", "Thailand", 
"Thailand", "Thailand", "Thailand", "Thailand", "Thailand", "Thailand", 
"Thailand", "Thailand", "Thailand", "Thailand", "Thailand", "Trinidad and Tobago", 
"Trinidad and Tobago", "Trinidad and Tobago", "Trinidad and Tobago", 
"Trinidad and Tobago", "Trinidad and Tobago", "Trinidad and Tobago", 
"Trinidad and Tobago", "Trinidad and Tobago", "Trinidad and Tobago", 
"Trinidad and Tobago", "Trinidad and Tobago", "Trinidad and Tobago", 
"Trinidad and Tobago", "Trinidad and Tobago", "Trinidad and Tobago", 
"Trinidad and Tobago", "Trinidad and Tobago", "Trinidad and Tobago", 
"Oman", "Oman", "Oman", "Oman", "Oman", "Oman", "Oman", "Oman", 
"Oman", "Oman", "Oman", "Oman", "Oman", "Oman", "Oman", "Oman", 
"Oman", "Oman", "Oman", "Tunisia", "Tunisia", "Tunisia", "Tunisia", 
"Tunisia", "Tunisia", "Tunisia", "Tunisia", "Tunisia", "Tunisia", 
"Tunisia", "Tunisia", "Tunisia", "Tunisia", "Tunisia", "Tunisia", 
"Tunisia", "Tunisia", "Tunisia", "Turkey", "Turkey", "Turkey", 
"Turkey", "Turkey", "Turkey", "Turkey", "Turkey", "Turkey", "Turkey", 
"Turkey", "Turkey", "Turkey", "Turkey", "Turkey", "Turkey", "Turkey", 
"Turkey", "Turkey", "United Arab Emirates", "United Arab Emirates", 
"United Arab Emirates", "United Arab Emirates", "United Arab Emirates", 
"United Arab Emirates", "United Arab Emirates", "United Arab Emirates", 
"United Arab Emirates", "United Arab Emirates", "United Arab Emirates", 
"United Arab Emirates", "United Arab Emirates", "United Arab Emirates", 
"United Arab Emirates", "United Arab Emirates", "United Arab Emirates", 
"United Arab Emirates", "United Arab Emirates", "UK", "UK", "UK", 
"UK", "UK", "UK", "UK", "UK", "UK", "UK", "UK", "UK", "UK", "UK", 
"UK", "UK", "UK", "UK", "UK", "Ukraine", "Ukraine", "Ukraine", 
"Ukraine", "Ukraine", "Ukraine", "Ukraine", "Ukraine", "Ukraine", 
"Ukraine", "Ukraine", "Ukraine", "Ukraine", "Ukraine", "Ukraine", 
"Ukraine", "Ukraine", "Ukraine", "Ukraine", "United States", 
"United States", "United States", "United States", "United States", 
"United States", "United States", "United States", "United States", 
"United States", "United States", "United States", "United States", 
"United States", "United States", "United States", "United States", 
"United States", "United States", "Uruguay", "Uruguay", "Uruguay", 
"Uruguay", "Uruguay", "Uruguay", "Uruguay", "Uruguay", "Uruguay", 
"Uruguay", "Uruguay", "Uruguay", "Uruguay", "Uruguay", "Uruguay", 
"Uruguay", "Uruguay", "Uruguay", "Uruguay", "Uzbekistan", "Uzbekistan", 
"Uzbekistan", "Uzbekistan", "Uzbekistan", "Uzbekistan", "Uzbekistan", 
"Uzbekistan", "Uzbekistan", "Uzbekistan", "Uzbekistan", "Uzbekistan", 
"Uzbekistan", "Uzbekistan", "Uzbekistan", "Uzbekistan", "Uzbekistan", 
"Uzbekistan", "Uzbekistan", "Venezuela", "Venezuela", "Venezuela", 
"Venezuela", "Venezuela", "Venezuela", "Venezuela", "Venezuela", 
"Venezuela", "Venezuela", "Venezuela", "Venezuela", "Venezuela", 
"Venezuela", "Venezuela", "Venezuela", "Venezuela", "Venezuela", 
"Venezuela", "Vietnam", "Vietnam", "Vietnam", "Vietnam", "Vietnam", 
"Vietnam", "Vietnam", "Vietnam", "Vietnam", "Vietnam", "Vietnam", 

"Other oceanea", "Other oceanea", "Other oceanea", "Other oceanea", 
"Other oceanea", "Other oceanea", "Other oceanea", "Other oceanea", 
"Other oceanea", "Other oceanea", "Other oceanea"), year = c("1992", 
"1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", 
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1992", "1993", "1994", 
"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", 
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", 
"1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", 
"2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", 
"2008", "2009", "2010", "1992", "1993", "1994", "1995", "1996", 
"1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", 
"2005", "2006", "2007", "2008", "2009", "2010", "1992", "1993", 
"1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", 
"2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", 
"2010", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", 
"2007", "2008", "2009", "2010", "1992", "1993", "1994", "1995", 
"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", 
"2004", "2005", "2006", "2007", "2008", "2009", "2010", "1992", 
"1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", 
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1992", "1993", "1994", 
"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", 
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", 
"1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", 
"2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", 
"2008", "2009", "2010", "1992", "1993", "1994", "1995", "1996", 
"1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", 
"2005", "2006", "2007", "2008", "2009", "2010", "1992", "1993", 
"1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", 
"2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", 
"2010", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", 
"2007", "2008", "2009", "2010", "1992", "1993", "1994", "1995", 
"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", 
"2004", "2005", "2006", "2007", "2008", "2009", "2010", "1992", 
"1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", 
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1992", "1993", "1994", 
"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", 
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", 
"1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", 
"2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", 
"2008", "2009", "2010", "1992", "1993", "1994", "1995", "1996", 
"1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", 
"2005", "2006", "2007", "2008", "2009", "2010", "1992", "1993", 
"1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", 
"2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", 
"2010", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", 
"2007", "2008", "2009", "2010", "1992", "1993", "1994", "1995", 
"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", 

"2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", 
"2010", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", 
"2007", "2008", "2009", "2010", "1992", "1993", "1994", "1995", 
"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", 
"2004", "2005", "2006", "2007", "2008", "2009", "2010", "1992", 
"1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", 
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1992", "1993", "1994", 
"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", 
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", 
"1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", 
"2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", 
"2008", "2009", "2010", "1992", "1993", "1994", "1995", "1996", 
"1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", 
"2005", "2006", "2007", "2008", "2009", "2010", "1992", "1993", 
"1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", 
"2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", 
"2010", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", 
"2007", "2008", "2009", "2010", "1992", "1993", "1994", "1995", 
"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", 
"2004", "2005", "2006", "2007", "2008", "2009", "2010", "1992", 
"1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", 
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1992", "1993", "1994", 
"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", 
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", 
"1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", 
"2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", 
"2008", "2009", "2010", "1992", "1993", "1994", "1995", "1996", 
"1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", 
"2005", "2006", "2007", "2008", "2009", "2010", "1992", "1993", 
"1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", 
"2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", 
"2010", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", 
"2007", "2008", "2009", "2010", "1992", "1993", "1994", "1995", 
"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", 
"2004", "2005", "2006", "2007", "2008", "2009", "2010", "1992", 
"1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", 
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1992", "1993", "1994", 
"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", 
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", 
"1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", 
"2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", 
"2008", "2009", "2010", "1992", "1993", "1994", "1995", "1996", 
"1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", 
"2005", "2006", "2007", "2008", "2009", "2010", "1992", "1993", 
"1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", 
"2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", 
"2010", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", 

"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1992", "1993", "1994", 
"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", 
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", 
"1992", "1993", "1995", "1996", "1997", "1998", "1999", "2000", 
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1994", "1995", "1996", 
"1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", 
"2005", "2006", "2007", "2008", "2009", "2010", "1992", "1993", 
"1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", 
"2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", 
"2010", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", 
"2007", "2008", "2009", "2010", "1992", "1993", "1994", "1995", 
"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", 
"2004", "2005", "2006", "2007", "2008", "2009", "2010", "1992", 
"1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", 
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1992", "1993", "1994", 
"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", 
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", 
"1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", 
"2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", 
"2008", "2009", "2010", "1992", "1993", "1994", "1995", "1996", 
"1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", 
"2005", "2006", "2007", "2008", "2009", "2010", "1992", "1993", 
"1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", 
"2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", 
"2010", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", 
"2007", "2008", "2009", "2010", "1992", "1993", "1994", "1995", 
"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", 
"2004", "2005", "2006", "2007", "2008", "2009", "2010", "1992", 
"1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", 
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1992", "1993", "1994", 
"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", 
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", 
"1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", 
"2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", 
"2008", "2009", "2010", "1992", "1993", "1994", "1995", "1996", 
"1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", 
"2005", "2006", "2007", "2008", "2009", "2010", "1992", "1993", 
"1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", 
"2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", 
"2010", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", 
"2007", "2008", "2009", "2010", "1992", "1993", "1994", "1995", 
"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", 
"2004", "2005", "2006", "2007", "2008", "2009", "2010", "1992", 
"1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", 
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1992", "1993", "1994", 
"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", 
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", 
"1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", 
"2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", 
"2008", "2009", "2010", "1992", "1993", "1994", "1995", "1996", 
"1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", 
"2005", "2006", "2007", "2008", "2009", "2010", "1992", "1993", 
"1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", 
"2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", 
"2010", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", 
"2007", "2008", "2009", "2010", "1992", "1993", "1994", "1995", 
"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", 
"2004", "2005", "2006", "2007", "2008", "2009", "2010", "1992", 
"1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", 
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1992", "1993", "1994", 
"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", 
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", 
"1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", 
"2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", 
"2008", "2009", "2010", "1992", "1993", "1994", "1995", "1996", 
"1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", 
"2005", "2006", "2007", "2008", "2009", "2010", "1992", "1993", 
"1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", 
"2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", 
"2010", "1992", "1993", "1994", "1995", "1996", "1997", "1998", 
"1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", 
"2007", "2008", "2009", "2010", "1992", "1993", "1994", "1995", 
"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", 
"2004", "2005", "2006", "2007", "2008", "2009", "2010", "1992", 
"1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", 
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", 
"2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", 
"2006", "2007", "2008", "2009", "2010", "1992", "1993", "1994", 
"1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", 

60L, 48L, 45L, 46L, 52L, 52L, 54L, 63L, 64L, 64L, 93L, 85L, 86L, 
87L, 76L, 76L, 106L, 108L, 128L, 138L, 151L, 253L, 279L, 192L, 
199L, 1232L, 1232L, 1296L, 1324L, 1254L, 1619L, 1698L, 1449L, 
1475L, 1557L, 2071L, 1728L, 103L, 169L, 106L, 95L, 77L, 111L, 
1971L, 83L, 89L, 95L, 186L, 131L)), row.names = c(NA, -2143L), class = "data.frame")

your data seems to have non standard variable names so would need to be quoted in backticks

`my variable with spaces in the name`

In my experience its a headache to have such names in your workflow, recommend renaming your variables
countryCode for example, then you wouldnt need backticks.

1 Like
suppressPackageStartupMessages({
  library(dplyr)
})
# dput(dat)
dat <- structure(list(country = c("Belgium_Luxemburg", "Belgium_Luxemburg", 
 "Belgium_Luxemburg", "Belgium_Luxemburg", "Belgium_Luxemburg", 
 "Belgium_Luxemburg", "Belgium_Luxemburg", "Belgium_Luxemburg", 
 "Belgium_Luxemburg", "Belgium_Luxemburg", "Belgium_Luxemburg", 
 "Belgium_Luxemburg", "Belgium_Luxemburg", "Belgium_Luxemburg", 
 "Belgium_Luxemburg", "Belgium_Luxemburg", "Belgium_Luxemburg", 
 "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", 
 "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", 
 "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", 
 "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", "Bolivia", 
 "Bolivia", "Bolivia", "Bolivia", "Bolivia", "Bolivia", "Bolivia", 
 "Bolivia", "Bolivia", "Bolivia", "Bolivia", "Bolivia", "Bolivia"
), year = c("2005", "2007", "2008", "2009", "2010", "1992", "1993", 
 "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", 
 "2002", "2003", "2004", "2005", "2007", "2008", "2009", "2010", 
 "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", 
 "2000", "2001", "2002", "2003", "2004", "2005", "2007", "2008", 
 "2009", "2010", "1992", "1993", "1994", "1995", "1996", "1997", 
 "1998", "1999"), quantity = c(60L, 48L, 45L, 46L, 52L, 52L, 54L, 
 63L, 64L, 64L, 93L, 85L, 86L, 87L, 76L, 76L, 106L, 108L, 128L, 
 138L, 151L, 253L, 279L, 192L, 199L, 1232L, 1232L, 1296L, 1324L, 
 1254L, 1619L, 1698L, 1449L, 1475L, 1557L, 2071L, 1728L, 103L, 
 169L, 106L, 95L, 77L, 111L, 1971L, 83L, 89L, 95L, 186L, 131L)), class = "data.frame", row.names = c(NA, 
  -49L))

dat %>% group_by(country) %>%
  count() %>%
  filter(n > 5)
#> # A tibble: 3 x 2
#> # Groups:   country [3]
#>   country               n
#>   <chr>             <int>
#> 1 Bangladesh           19
#> 2 Belgium_Luxemburg    17
#> 3 Bolivia              13

Created on 2020-12-04 by the reprex package (v0.3.0.9001)

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.