View source: R/download_w2_data.R
| download_w2_data | R Documentation | 
This function requires an installed ODBC driver for MS SQL Server 2012. The database credentials are handled via environment variables.
download_w2_data(
  ord = c("YmdHMS", "Ymd"),
  tz = "Australia/Perth",
  db_drv = Sys.getenv("W2_DRV"),
  db_srv = Sys.getenv("W2_SRV"),
  db_name = Sys.getenv("W2_DB"),
  db_user = Sys.getenv("W2_UN"),
  db_pass = Sys.getenv("W2_PW"),
  db_port = Sys.getenv("W2_PT"),
  verbose = wastdr::get_wastdr_verbose(),
  dsn = Sys.getenv("W2_DSN"),
  use_rodbc = Sys.getenv("W2_RODBC", FALSE),
  save = NULL,
  compress = "xz"
)
ord | 
 Lubridate orders, default:   | 
tz | 
 Timezone, default:   | 
db_drv | 
 Database driver, default:   | 
db_srv | 
 Database server, default:   | 
db_name | 
 The database name, default:   | 
db_user | 
 The read-permitted database user,
default:   | 
db_pass | 
 The database user's password, default:   | 
db_port | 
 The database port, default:   | 
verbose | 
 Whether to show debug messages. Default: wastdr::get_wastdr_verbose()  | 
dsn | 
 The DSN for Windows systems, default:   | 
use_rodbc | 
 Whether to use the RODBC library (if TRUE, best for Windows systems), or the odbc/DBI library (if FALSE, default, best for GNU/Linux systems).  | 
save | 
 If supplied, the filepath to save the data object to.  | 
compress | 
 The saveRDS compression parameter, default: "xz". Set to FALSE for faster writes and reads but larger filesize.  | 
In Windows systems, create a user defined DSN with settings
name WAMTRAMPROD
server kens-mssql-001-prod.corporateict.domain
SQL auth using login ID and password entered by user
trust server certificate (this is where odbc falls over)
Add to .Renviron: W2_RODBC=TRUE W2_DSN="WAMTRAMPROD"
A structure of class "wamtram_data" containing a named list of sanitised tables from the Turtle Tagging DB:
Metadata:
downloaded_on
w2_tables
Personnel:
persons
Data entry:
data_entry_batches "TRT_ENTRY_BATCHES"
data_entry
data_entry_operators
Lookups:
lookup_beach_positions
lookup_body_parts
lookup_conditions
lookup_damage_causes
lookup_damage_codes
lookup_datum_codes
lookup_egg_count_methods
lookup_id_types
lookup_measurement_types
lookup_pit_tag_states
lookup_sample_tissue_type
lookup_tag_states
Places:
sites
Encounters:
enc
location_code: the original rookery (where first encountered)
place_code: the place of the encounter (where currently found)
enc_qa
Observations:
obs_flipper_tags
obs_pit_tags
obs_damages
obs_measurements
obs_samples
Reconstructed:
reconstructed_pit_tags
reconstructed_tags
reconstructed_turtles
Other wamtram: 
map_wamtram(),
w2_online()
## Not run: 
# Credentials are set in .Renviron
wamtram_data <- download_w2_data()
# develop:
ord <- c("YmdHMS", "Ymd")
tz <- "Australia/Perth"
verbose <- wastdr::get_wastdr_verbose()
con <- DBI::dbConnect(
  odbc::odbc(),
  Driver   = Sys.getenv("W2_DRV"),
  Server   = Sys.getenv("W2_SRV"),
  Database = Sys.getenv("W2_DB"),
  UID      = Sys.getenv("W2_UN"),
  PWD      = Sys.getenv("W2_PW"),
  Port     = Sys.getenv("W2_PT")
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.