View source: R/gen_random_table.R
gen_random_table | R Documentation |
This function enables the user to generate a temporary table in the database that will persist for this connection/session, and that can be utilized in subsequent queries, in order to consistently restrict to that subset. This may be helpful for users to execute an analytic pipeline on a random set of ids.
gen_random_table(
table,
idvars,
schema = "dbo",
size = 1000,
filter = NULL,
seed = NULL,
engine = default_engine
)
table |
string table name to query |
idvars |
vector of string column names that define uniqueness on the table (i.e. the primary key) |
schema |
name of schema (default "dbo") |
size |
number of rows to return (default=1000) |
filter |
string 'WHERE' clause to further restrict the selection |
seed |
integer seed for reproducibility; if no seed is provided, a non-reproducible temp table will be produced |
engine |
a dbConnect connection object; by default will look in namespace for default_engine |
a string name of the temporary table created
rnduids <- gen_random_table(table= "patient", idvars = "osler_id", size = 1000, seed=123)
rnduids <- gen_random_table(table= "patient", idvars = "osler_id", size = 100, seed=87634)
rnduids <- gen_random_table(table= "patient", idvars = "osler_id", filter = "WHERE gender = 'Male'", size = 100, seed=87634)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.