Skip to content

Instantly share code, notes, and snippets.

title output
Simple SQL and dplyr
html_document
keep_md
true

Load Packages

@boshek
boshek / tidyhydat_col_names_eval.R
Last active August 14, 2018 14:38
A script to extract the column names for most tidyhydat functions
library(tidyverse)
# Functions ---------------------------------------------------------------
eval_funcs <- function(x){
cat(x,"\n")
if(grepl("hy_", x)){
return(names(eval(parse(text = paste0(x,"(hydat_path = hy_test_db())")))))
}
if(grepl("realtime_",x)){
# Packages ----------------------------------------------------------------
library(sf)
library(dplyr)
library(tidyhydat)
library(readr)
library(ggplot2)
library(here)
library(raster)
@boshek
boshek / Station_selection.R
Last active October 17, 2017 22:19
Find all current hydrometric stations then subset by NRD
library(tidyverse)
library(sf)
library(tidyhydat)
library(bcmaps)
## Say get Thompson District
nr_district_to <- st_as_sf(nr_districts) %>%
filter(REG_ORG_UN == "Thompson-Okanagan Natural Resource Region")
@boshek
boshek / corrr_purrr_group.md
Last active October 11, 2017 23:48
Correlation Network Plots by Group with purrr, corrr and ggraph

Correlation Network Plots by Groups

Packages

To run this you will need the following packages:

library(corrr)