Skip to contents

This function calculates quantile metrics (Q1, Q2, Q3, Q4, Q5) for a selected metric within a specified region.

Usage

sld_get_quantile_metric(selected_region_id, selected_metric, con)

Arguments

selected_region_id

The ID of the selected region.

selected_metric

The name of the selected metric.

con

PqConnection to Postgresql database.

Value

A numeric vector containing quantile metrics (Q1, Q2, Q3, Q4, Q5) for the selected metric within the specified region.

Examples

con <- db_con()
#> Error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
#> 	Is the server running locally and accepting connections on that socket?
# get quantiles from active_channel_width metric
quantile_metrics <- sld_get_quantile_metric(selected_region_id = 11,
                                            selected_metric = "active_channel_width",
                                            con = con)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'conn' in selecting a method for function 'sqlInterpolate': object 'con' not found
quantile_metrics
#> Error in eval(expr, envir, enclos): object 'quantile_metrics' not found
DBI::dbDisconnect(con)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'conn' in selecting a method for function 'dbDisconnect': object 'con' not found