R/curve_snowflake.R
curve_snowflake.RdConnects to a Snowflake database and constructs consonance distributions from query results containing point estimates and confidence intervals.
curve_snowflake(conn, query, estimate_col = "estimate",
lower_col = "lower", upper_col = "upper", conf.level = 0.95,
steps = 1000, cores = getOption("mc.cores", 1L), table = TRUE)A DBI connection object to Snowflake database.
SQL query string that returns columns for estimate, lower, and upper bounds.
Name of the column containing point estimates. Default is "estimate".
Name of the column containing lower bounds. Default is "lower".
Name of the column containing upper bounds. Default is "upper".
Confidence level of the input intervals. Default is 0.95.
Number of consonance levels to compute. Default is 1000.
Number of cores for parallel computation.
Logical. If TRUE (default), includes a summary table.
A list with class "concurve" containing the intervals dataframe, density dataframe, and optionally a summary table.
This function requires the DBI and odbc packages to be installed. It connects to Snowflake, executes the provided query, and constructs consonance functions from the results.
curve_snowflake_batch() for batch processing
curve_rev() for constructing curves from published intervals
export_for_powerbi() for exporting results
if (FALSE) { # \dontrun{
library(DBI)
library(odbc)
# Connect to Snowflake
conn <- dbConnect(odbc::odbc(),
Driver = "Snowflake",
Server = "your_account.snowflakecomputing.com",
Database = "your_database",
Schema = "your_schema",
UID = "your_username",
PWD = "your_password"
)
# Query with estimate and CI columns
query <- "SELECT estimate, lower_ci, upper_ci FROM results WHERE analysis_id = 1"
result <- curve_snowflake(conn, query,
estimate_col = "estimate",
lower_col = "lower_ci",
upper_col = "upper_ci"
)
ggcurve(result[[1]], type = "c")
dbDisconnect(conn)
} # }