I'd like to calculate the frequency of each country code by year and make a stacked column graph "frequency x year", with the country codes being the stacked columns.
I'm beginner on R, and I don't know the best way to do this
Thanks.
dput(head(table_suinos_p.country, 20))
structure(list(suinos.p.year = structure(c(9L, 8L, 14L, 7L, 14L,
14L, 16L, 11L, 13L, 9L, 1L, 8L, 16L, 13L, 16L, 5L, 15L, 16L,
9L, 18L), .Label = c("1998", "1999", "2000", "2001", "2002",
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010",
"2011", "2012", "2013", "2014", "2015", "2016", "2017"), class = "factor"),
suinos.p.country = structure(c(4L, 17L, 3L, 17L, 1L, 17L,
11L, 17L, 17L, 17L, 17L, 17L, 6L, 5L, 17L, 17L, 17L, 11L,
6L, 11L), .Label = c("AU", "CA", "CN", "CU", "DE", "EP",
"FR", "GB", "IT", "JP", "KR", "PL", "RU", "SG", "TH", "TW",
"US", "WO"), class = "factor")), row.names = c(NA, 20L), class = "data.frame")