Description Usage Arguments Value Examples
Allows to save connectR's sql query in local file and save to a string for further tbl's. NOTE: save_query will only work with lazy evaluation objects.
1 |
x: |
Lazy evaluation object. Object created from the function 'tbl'. |
save_sql: |
Saves connectR sql when set to 'TRUE', default set to 'FALSE'. |
path: |
Path to save file, default set to work directory 'getwd()'. |
name: |
Name of the file, default set to "connectR_sql". Name is only needed and file type is not needed. |
type: |
File type for saving local file for example '.txt', defaults to '.SQL'. |
Returns string format of connectR's sql, and optional save to local file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #Save lazy evaluation sql to a string
tbl(post,sql("SELECT * FROM
CALENDAR")) %>%
group_by(ACCOUNT_YEAR_WEEK,
SEASON) %>%
summarise(WEEK_ENDING=max(CAL_DATE)) %>%
save_query ->SQL
#Uses sql string for further lazy_evaluation querying
tbl(post,sql(SQL))
#Save lazy evaluation sql to default location `getwd()`
#with default name `connectR_sql`
tbl(post,sql("SELECT * FROM
CALENDAR")) %>%
group_by(ACCOUNT_YEAR_WEEK,
SEASON) %>%
summarise(WEEK_ENDING=max(CAL_DATE)) %>%
save_query(save_query=TRUE)
#Save lazy evaluation sql to default location `C:/R_CODE`
#with default name `connectR_sql`
tbl(post,sql("SELECT * FROM
CALENDAR")) %>%
group_by(ACCOUNT_YEAR_WEEK,
SEASON) %>%
summarise(WEEK_ENDING=max(CAL_DATE)) %>%
save_query(save_query=TRUE, path="C:/R_CODE")
#Save lazy evaluation sql to default location `C:/R_CODE`
#with name `Test_sql`
tbl(post,sql("SELECT * FROM
CALENDAR")) %>%
group_by(ACCOUNT_YEAR_WEEK,
SEASON) %>%
summarise(WEEK_ENDING=max(CAL_DATE)) %>%
save_query(save_query=TRUE, path="C:/R_CODE", name="Test_sql")
#Save lazy evaluation sql to default location `C:/R_CODE`
#with name `Test_sql` and type ".txt" text file.
tbl(post,sql("SELECT * FROM
CALENDAR")) %>%
group_by(ACCOUNT_YEAR_WEEK,
SEASON) %>%
summarise(WEEK_ENDING=max(CAL_DATE)) %>%
save_query(save_query=TRUE, path="C:/R_CODE", name="Test_sql",type=".txt")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.