Description Usage Arguments Value Examples
Query the database efficiently and cache data appropriately in subdirectories
1 2 |
sql |
SQL query to run |
name |
name of query |
subs |
One row data frame whose column names are the substrings to replace, and whose values are the strings to replace them with. |
data.dir |
Query results directory. Stores the results of the SQL queries as RDS files. |
sql.dir |
SQL query directory. Stores all the SQL used. If subs were provided, it saves the query before the subs were inserted. |
subs.dir |
Subs directory. Stores all the individual subs for each query as a data frame. |
daily |
Boolean to indicate whether to force a rerun of the query on first execution each day. |
overwrite |
Boolean to indicate whether to force a rerun of the query. |
Data frame of the query results
1 2 3 4 5 6 7 8 9 10 | sys.setenv(
'db_dsn' = 'mydb',
'db_username' = 'myuser',
'db_password' = 'password'
)
sql <- "select 1 as a from dual where 1 = XnumberX"
subs <- data.frame('XnumberX' = 1)
rquery(sql, 'myquery', subs)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.