error trying to build a histogram using r with the rStudio application Using ggplot2 I am attempting to create a histogram.  I have a column that is full on the continents.  I need to add all the continents which I attempted to do with the aggregate function.

data &lt;- aggregate(country$continent,country["continent"], sum)
hist(data)


Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,  : 
  ‘sum’ not meaningful for factors
The following code :

data.frame(table(country$continent))


will create a dataframe where one column is the continent and the other is the number of countries in the continent.