createRWrapperForSql
creates an R wrapper for a parameterized SQL file. The created R script
file will contain a single function, that executes the SQL, and accepts the same parameters as
specified in the SQL.
createRWrapperForSql(
sqlFilename,
rFilename,
packageName,
createRoxygenTemplate = TRUE
)
This function reads the declarations of defaults in the parameterized SQL file, and creates an R
function that exposes the parameters. It uses the loadRenderTranslateSql
function, and
assumes the SQL will be used inside a package. To use inside a package, the SQL file should be
placed in the inst/sql/sql_server folder of the package.
if (FALSE) { # \dontrun{
# This will create a file called CohortMethod.R:
createRWrapperForSql("CohortMethod.sql", packageName = "CohortMethod")
} # }