emissions: Import data table from greenhouse gas emissions scenario...

emissions_connectionR Documentation

Import data table from greenhouse gas emissions scenario planning database

Description

Import data table from greenhouse gas emissions scenario planning database

Usage

emissions_connection(
  uid = getOption("councilR.uid"),
  pwd = getOption("councilR.pwd"),
  local = TRUE,
  db = "CD_Emissions"
)

import_from_emissions(
  table_name,
  uid = getOption("councilR.uid"),
  pwd = getOption("councilR.pwd"),
  local = TRUE,
  db = "CD_Emissions"
)

Arguments

uid

character, your network ID. Default is getOption("councilR.uid"). If you are accessing Azure, this value should be your full email address.

pwd

character, your network password. Default is getOption("councilR.pwd"). For example, "my_password"

local

logical, whether to pull from the onsite database or Azure. Default is TRUE.

db

character, database name. Default is "CD_Emissions".

table_name

character, which table to pull.

Details

To access Azure, your IP address must be approved. Contact Sean Molloy.

Value

Requested table

import_from_emissions() - Requested table

Note

See vignette("Options") to review package options. You must be set up with the appropriate database drivers to use these functions. Windows users need ODBC with Microsoft SQL. Contact IS support for ODBC installation. Mac users need unixodbc and freetds. See instructions in the onboarding guide

These functions rely on `{rlang}` internal functions.

See Also

Other database functions: FRED_connection(), gis_connection()

Examples

## Not run: 

library(councilR)
library(DBI)

# set options if you haven't already
options(
  councilR.uid = "mc\\you",
  councilR.pwd = "mypwd"
)

# create connection
conn <- emissions_connect()

# pull table using SQL
DBI::dbGetQuery(conn, "SELECT * FROM metro_energy.vw_electricity_residential_ctu")

# disconnect
DBI::dbDisconnect(conn)

# get specific tables
t_electricity_residential_ctu <- import_from_emissions(
  table_name = "metro_energy.vw_electricity_residential_ctu"
)

t_eia_energy_consumption_state <- import_from_emissions(
  table_name = "state_energy.eia_energy_consumption_state"
)

t_utility_natural_gas_by_ctu <- import_from_emissions(
  table_name = "metro_energy.vw_utility_natural_gas_by_ctu"
)

## End(Not run)


Metropolitan-Council/councilR documentation built on March 30, 2024, 2:43 a.m.