I'm trying to create a function in R that takes two inputs, the dataset name and a column from the dataset. I want to display all the continents and the total population of the continents when the dataset name and the column is inserted as parameters. I'm currently using the code below but it displays all the continents with 0 population. How can I display the total population next to each continent instead of 0. Any help will be greatly appreciated, thanks.
continentLifeExp <- function(data, column){
continents <- group_by(data, Continent)
summarise(continents, population = sum(data$`column`))
}