How can I create variables and strings using the value passed by the loop?
Example
I have a set of countries = c('USA','Canada','Mexico').
I have a dataframe 'population'.
I want to query my database to get their population, and assign it to a column in a data frame. Don't worry about accessing the database, I am only concerned with dynamically creating the query string and the dataframe column name.
for (country in countries) {
query = "SELECT population FROM population_database WHERE location='country';"
population$country = mysql_query(query)
}