-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
525 additions
and
241 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
.DS_Store | ||
.Rproj.user | ||
ClimbWith.Rcheck/ | ||
ClimbWith/rsconnect/shinyapps.io/guslipkin/ClimbWith.dcf | ||
ClimbWith_0.0.0.9000.tar.gz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ dev_history.R | |
^dev$ | ||
$run_dev.* | ||
^.here$ | ||
^app\.R$ | ||
^rsconnect$ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Package: ClimbWith | ||
Title: Find Rock Climbing Gyms | ||
Version: 0.0.0.9000 | ||
Authors@R: person('Gus', 'Lipkin', email = '[email protected]', role = c('cre', 'aut')) | ||
Description: Look for rock climbing gyms based on features you want | ||
License: What license is it under? | ||
Imports: | ||
config (>= 0.3.2), | ||
golem (>= 0.4.1), | ||
rlang, | ||
shiny (>= 1.8.0), | ||
DT, | ||
bs4Dash, | ||
dplyr, | ||
glue, | ||
htmltools, | ||
janitor, | ||
leaflet, | ||
purrr, | ||
readr, | ||
shinyWidgets, | ||
stringr, | ||
tibble, | ||
tidyr, | ||
tidyselect, | ||
waiter | ||
Encoding: UTF-8 | ||
LazyData: true | ||
RoxygenNote: 7.2.3 | ||
Suggests: | ||
testthat (>= 3.0.0) | ||
Config/testthat/edition: 3 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#' @keywords internal | ||
"_PACKAGE" | ||
|
||
## usethis namespace: start | ||
#' @importFrom rlang .data | ||
## usethis namespace: end | ||
NULL |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Disabling shiny autoload | ||
|
||
# See ?shiny::loadSupport for more information |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#' The application server-side | ||
#' | ||
#' @param input,output,session Internal parameters for {shiny}. | ||
#' DO NOT REMOVE. | ||
#' @import shiny | ||
#' @noRd | ||
app_server <- function(input, output, session) { | ||
shiny::updateActionButton(inputId = 'clear_filters', label = 'Clear Filters') | ||
full_data <- .get_data() | ||
dat <- shiny::reactiveVal(full_data) | ||
output$map <- | ||
dat() |> | ||
.create_map() |> | ||
leaflet::renderLeaflet() | ||
output$table <- | ||
dat() |> | ||
.create_table() |> | ||
DT::renderDT() | ||
|
||
shiny::observe({ | ||
shinyWidgets::updateAwesomeCheckboxGroup(session, inputId = 'filter_climbing', selected = FALSE) | ||
shinyWidgets::updateAwesomeCheckboxGroup(session, inputId = 'filter_fitness', selected = FALSE) | ||
shinyWidgets::updateSliderTextInput( | ||
session, inputId = 'filter_board_angle', | ||
choices = c('Adjustable', as.character(seq(0L, 90L, by = 5L))), | ||
selected = c('Adjustable', '90') | ||
) | ||
shinyWidgets::updateAwesomeCheckboxGroup(session, inputId = 'filter_generic_board', selected = FALSE) | ||
shinyWidgets::updatePickerInput(session, inputId = 'filter_kilter_board_size', selected = FALSE) | ||
shinyWidgets::updatePickerInput(session, inputId = 'filter_tension1_board_size', selected = FALSE) | ||
shinyWidgets::updatePickerInput(session, inputId = 'filter_tension1_board_set', selected = FALSE) | ||
shinyWidgets::updatePickerInput(session, inputId = 'filter_tension2_board_size', selected = FALSE) | ||
shinyWidgets::updatePickerInput(session, inputId = 'filter_tension2_board_set', selected = FALSE) | ||
shinyWidgets::updatePickerInput(session, inputId = 'filter_moonboard_board_set', selected = FALSE) | ||
}) |> | ||
shiny::bindEvent(input$clear_filters, ignoreNULL = TRUE, ignoreInit = FALSE) | ||
|
||
shiny::observe({ | ||
dt <- if (is.null(input$table_rows_selected)) dat() else dat()[input$table_rows_selected,] | ||
if (nrow(dt) == 0) { | ||
shinyWidgets::show_alert( | ||
title = 'No Matches', | ||
text = 'No gyms match your filters', | ||
type = 'warning' | ||
) | ||
} | ||
leaflet::leafletProxy('map', data = dt) |> | ||
.add_markers_and_fit(dt) | ||
}) |> | ||
shiny::bindEvent(dat(), input$table_rows_selected, ignoreNULL = FALSE, ignoreInit = TRUE) | ||
|
||
shiny::observe({ | ||
full_data |> | ||
.filter_climbing(input$filter_climbing) |> | ||
.filter_fitness(input$filter_fitness) |> | ||
.filter_board_angle(input$filter_board_angle) |> | ||
.filter_generic_board(input$filter_generic_board) |> | ||
.filter_sictb( | ||
input$filter_kilter_board_size, | ||
input$filter_tension1_board_size, input$filter_tension1_board_set, | ||
input$filter_tension2_board_size, input$filter_tension2_board_set, | ||
input$filter_moonboard_board_set | ||
) |> | ||
dat() | ||
}) |> | ||
shiny::bindEvent( | ||
input$filter_climbing, input$filter_fitness, | ||
input$filter_board_angle, input$filter_generic_board, | ||
input$filter_kilter_board_size, | ||
input$filter_tension1_board_size, input$filter_tension1_board_set, | ||
input$filter_tension2_board_size, input$filter_tension2_board_set, | ||
input$filter_moonboard_board_set, | ||
ignoreNULL = FALSE, ignoreInit = TRUE | ||
) | ||
} |
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#' data | ||
#' | ||
#' @description A utils function | ||
#' | ||
#' @return The return value, if any, from executing the utility. | ||
#' | ||
#' @noRd | ||
.get_data <- function() { | ||
readr::read_csv('data/data.csv', show_col_types = FALSE) |> | ||
janitor::clean_names() |> | ||
dplyr::mutate( | ||
dplyr::across( | ||
tidyselect::matches('spray_wall|board_'), # fix training boards | ||
\(x) { | ||
dplyr::case_when( | ||
x == 'Unknown' ~ '-2', | ||
x == 'Adjustable' ~ '-1', | ||
.default = as.character(x) | ||
) |> | ||
as.integer() | ||
} | ||
), | ||
dplyr::across( | ||
tidyselect::everything(), | ||
\(x) { | ||
if (!all(unique(x) %in% c('Yes', 'No', ''))) return(x) | ||
dplyr::case_match(x, 'Yes' ~ TRUE, 'No' ~ FALSE, '' ~ NA) | ||
} | ||
), | ||
'lat' = purrr::map_dbl(.data$google_maps_link, \(x) { | ||
stringr::str_match(x, '/@(-?\\d+\\.\\d+),')[1,2] |> | ||
as.numeric() | ||
}), | ||
'lon' = purrr::map_dbl(.data$google_maps_link, \(x) { | ||
stringr::str_match(x, ',(-?\\d+\\.\\d+),\\d+')[1,2] |> | ||
as.numeric() | ||
}) | ||
) |> | ||
dplyr::mutate( | ||
'full_name' = .data$gym_name, | ||
'name' = janitor::make_clean_names(.data$gym_name), | ||
.before = 1 | ||
) |> | ||
dplyr::select(-'gym_name') |> | ||
dplyr::arrange(.data$full_name) -> dt | ||
} | ||
|
||
.table_lookup <- function(lookup = TRUE) { | ||
c( | ||
"kilter_board_7x10_home" = 'Kilter 7x10 (Home)', | ||
"kilter_board_8x12" = 'Kilter 8x12', | ||
"kilter_board_12x12" = 'Kilter 12x12', | ||
"kilter_board_16x12" = 'Kilter 16x12', | ||
"tension_board_tension_1_8x10_set_a" = 'Tension 1 8x10 Set A', | ||
"tension_board_tension_1_8x10_set_b" = 'Tension 1 8x10 Set B', | ||
"tension_board_tension_1_8x10_set_c" = 'Tension 1 8x10 Set C', | ||
"tension_board_tension_1_8x12_set_a" = 'Tension 1 8x12 Set A', | ||
"tension_board_tension_1_8x12_set_b" = 'Tension 1 8x12 Set B', | ||
"tension_board_tension_1_8x12_set_c" = 'Tension 1 8x12 Set C', | ||
"tension_board_tension_2_8x10_spray" = 'Tension 2 8x10 Spray', | ||
"tension_board_tension_2_8x10_mirror" = 'Tension 2 8x10 Mirror', | ||
"tension_board_tension_2_8x12_spray" = 'Tension 2 8x12 Spray', | ||
"tension_board_tension_2_8x12_mirror" = 'Tension 2 8x12 Mirror', | ||
"tension_board_tension_2_12x10_spray" = 'Tension 2 12x10 Spray', | ||
"tension_board_tension_2_12x10_mirror" = 'Tension 2 12x10 Mirror', | ||
"tension_board_tension_2_12x12_spray" = 'Tension 2 12x12 Spray', | ||
"tension_board_tension_2_12x12_mirror" = 'Tension 2 12x12 Mirror', | ||
"moon_board_moon_board_2016" = 'MoonBoard 2016', | ||
"moon_board_moon_board_2017" = 'MoonBoard 2017', | ||
"moon_board_moon_board_2019" = 'MoonBoard 2019', | ||
"moon_board_moon_board_2024" = 'MoonBoard 2024', | ||
"moon_board_moon_board_mini_2020" = 'MoonBoard Mini 2020', | ||
"spray_wall" = "Spray Wall" | ||
)[lookup] | ||
} |
Oops, something went wrong.