This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To generate the footprint_polys data | |
footprint_poly <- function() { | |
#' Returns object of class SpatialPolygons of the AgC footprint. | |
#' Utilizes the Tigris:: package. | |
require(tidyverse) | |
require(tigris) | |
require(sf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(leaflet) | |
leaflet() %>% | |
addTiles() %>% | |
addPolygons(data = ketchR::footprint_poly()) %>% | |
addCircles(data = branches, | |
lat = branches$lat, | |
lng = branches$lon, | |
radius = 40000, | |
stroke = F, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_db <- function(query = "SELECT TOP 10 * FROM datas.dbo.Customers") { | |
#' Pull data from g23 database | |
#' @param query: enter a SQL query; Microsoft SQL syntax please | |
require(odbc) | |
con <- dbConnect(odbc(), | |
Driver = "SQL Server", | |
Server = "datas", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_customers <- function() { | |
#' Pull most recent customer data from G23 - datascience.agc_Customers | |
require(odbc) | |
con <- dbConnect(odbc(), | |
Driver = "SQL Server", | |
Server = "datas", | |
Database = "dataserver", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(leaflet) | |
leaflet() %>% | |
addTiles() %>% | |
addPolygons(data = ketchR::footprint_poly()) %>% | |
addCircles(data = branches, | |
lat = branches$lat, | |
lng = branches$lon, | |
radius = 40000, | |
stroke = F, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Palette main colors | |
ketch.styles <- c( | |
`salmon` = "#F16876", | |
`light_blue`= "#00A7E6", | |
`light_grey` = "#E8ECF8", | |
`brown` = "#796C68") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create separate palettes | |
agc.palettes <- list( | |
`main` = styles('salmon','light_blue', 'brown', 'light_grey'), | |
`cool` = styles('light_blue', 'light_grey') | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Palette main colors | |
ketch.styles <- c( | |
`salmon` = "#F16876", | |
`light_blue`= "#00A7E6", | |
`light_grey` = "#E8ECF8", | |
`brown` = "#796C68") | |
# Fn to extract them by hex codes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ggplot(mtcars) + | |
geom_point(aes(mpg, disp, color = qsec), alpha = 0.5, size = 6) + | |
ketchR::scale_color_ketch(palette = "main", discrete = F) + | |
theme_minimal() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dir.create("ketchbrookTemplate/inst/rmarkdown/templates/report/skeleton", | |
recursive = TRUE) |
OlderNewer