This function gives low-level access to the underlying HYDAT database used by
other functions. Many of these tables are too large to load into memory,
so it is best to use dplyr to
dplyr::filter() them before using
dplyr::collect() to read them into memory.
1 2 3
The path to the hydat database or NULL to use the default location used by download_hydat. It is also possible to pass in an existing src_sqlite such that the database only needs to be opened once per user-level call.
A as returned by
A SQLite DBIConnection
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
## Not run: library(dplyr) # src is a src_sqlite src <- hy_src(hydat_path = hy_test_db()) src_tbls(src) # to get a table, use dplyr::tbl() tbl(src, "STATIONS") # one you're sure the results are what you want # get a data.frame using collect() tbl(src, "STATIONS") %>% filter(PROV_TERR_STATE_LOC == "BC") %>% collect() # close the connection to the database hy_src_disconnect(src) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.