emissions_connection | R Documentation |
Import data table from greenhouse gas emissions scenario planning database
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"
)
uid |
character, your network ID.
Default is |
pwd |
character, your network password.
Default is |
local |
logical, whether to pull from the onsite database or Azure.
Default is |
db |
character, database name. Default is |
table_name |
character, which table to pull. |
To access Azure, your IP address must be approved. Contact Sean Molloy.
Requested table
import_from_emissions()
- Requested table
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.
Other database functions:
FRED_connection()
,
gis_connection()
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.