I have a dataframe which has 6 rows with SQL queries in each line. I want to execute every query and assign the output to a dataframe. currently I have 6 line of codes as below:
df6 <- tbl(conn,sql(df[6,]))
Is there a way I can loop through and assign the same in one statement using dplyr mutate function?
I tried below:
i <- 1:nrow(df)
df %>% mutate(paste0('df',i) <- tbl(conn,sql(df[i,])))
This throws the following error:
Error: Column
q1must be a 1d atomic vector or a list.
Any help is appreciated.