I now there are various answers on using dplyr inside function but i tried all methods and neither worked.
Here is my simple function:
loadData_gfi_zse <- function(table_name = "mytable_name"){
con <- DBI::dbConnect(RMySQL::MySQL(),
host = "xxxx",
user = "xxxx",
password = "xxxx",
dbname = "xxxxs")
table_name <- substitute(table_name)
df <- tbl(con, lazyeval::interp(table_name))
dbDisconnect(con)
df_clean
}
I tried wit rlang::!!
and other methods but neither work. This should be straightforward, but I can't get it work.