get_data: get_data

get_dataR Documentation

get_data

Description

This function contains the logic for deciding whether to extract or load data. It is aware of the required tables, and if all are present,it will load them into the global environment. If some are missing, it will offer to re-extract them. If the user chooses to re-extract, it will get their oracle credentials and verify that the user has access to all of the required tables prior to attempting an extraction.

Usage

get_data(
  db = NULL,
  usepkg = "rodbc",
  force.extract = FALSE,
  data.dir = file.path(getwd(), "data"),
  fn.oracle.username = "_none_",
  fn.oracle.password = "_none_",
  fn.oracle.dsn = "_none_",
  env = .GlobalEnv,
  quiet = FALSE
)

Arguments

db

default is NULL. This identifies the dataset you are working with. Valid values include the following (assuming you have Oracle access)

  • rv - Bottom Trawl Surveys conducted in shore waters off south west Nova Scotia

  • rvp70 - Bottom Trawl Surveys conducted in shore waters off south west Nova Scotia conducted prior to 1970

  • isdb - DFO at-sea fish catch observations from commercial fishing vessels operating in the North West Atlantic.

  • chid - Exploratory fishing surveys of the benthic fish fauna at 900-1800m.

  • redfish - A survey using stratified random design with day/night replication targeting deep sea redfish

  • marfis - A Policy and Economics Branch database that houses information on the fisheries of the Scotia-Fundy region, including data related to catch and effort.

  • comland67 - Commercial Landings (1967-1985) - like MARFIS, but earlier.

  • comland86 - Commercial Landings (1986-2001) - like MARFIS, but earlier. This is separated from the 1967 - 1985 COMLAND data due to differences in the code tables.

  • stomach - Stomach Contents Database

  • asef - Tagged salmon records at fishways

  • meso - Mesopelagic Database

  • meso_gully - Mesopelagic Gully Database

  • juvesh - Juvenile Silver Hake Database

usepkg

default is 'rodbc'. This indicates whether the connection to Oracle should use 'rodbc' or 'roracle' to connect. rodbc is slightly easier to setup, but roracle will extract data ~ 5x faster.

force.extract

The default value is FALSE. By default, existing data will be loaded. If force.extract ==TRUE, than a full extraction will take place, overwriting any existing data.

data.dir

The default is your working directory. If you are hoping to load existing data, this folder should identify the folder containing your *.rdata files.

fn.oracle.username

default is '_none_' This is your username for accessing oracle objects. If you have a value for oracle.username stored in your environment (e.g. from an rprofile file), this can be left out and that value will be used. If a value for this is provided, it will take priority over your existing value.

fn.oracle.password

default is '_none_' This is your password for accessing oracle objects. If you have a value for oracle.password stored in your environment (e.g. from an rprofile file), this can be left out and that value will be used. If a value for this is provided, it will take priority over your existing value.

fn.oracle.dsn

default is '_none_' This is your dsn/ODBC identifier for accessing oracle objects. If you have a value for oracle.dsn stored in your environment (e.g. from an rprofile file), this can be left and that value will be used. If a value for this is provided, it will take priority over your existing value.

env

This the the environment you want this function to work in. The default value is .GlobalEnv.

quiet

default is FALSE. If True, no text describing progress will be shown.

Author(s)

Mike McMahon, Mike.McMahon@dfo-mpo.gc.ca

See Also

Other dfo_extractions: get_data_custom(), get_survey(), self_filter(), summarize_catches()


Maritimes/Mar.datawrangling documentation built on Feb. 6, 2024, 3:25 a.m.