I would like to extract some data from a MySQL server. Therefore Im using the following code:
#connect to database
getPlayersHome <- dbGetQuery(con,"SELECT * FROM match_player_home WHERE match_id = 1;")
This works fine, however I would like include it in a function with a parameter. But if I do this:
getData <- function(selector){
getPlayersHome <- dbGetQuery(con,"SELECT * FROM match_player_home WHERE match_id = selector;")
}
My query does not work (it returns everything). Any thoughts on what goes wrong here?