OliverKeyes has submitted this change and it was merged.
Change subject: Add spider selector
......................................................................
Add spider selector
Change-Id: I605973e2e76a4cafcab175152c420d444ddabfd3
---
M NAMESPACE
M R/manipulate.R
M R/shiny.R
A man/automata_select.Rd
M man/check_notify.Rd
M man/cond_color.Rd
M man/cond_icon.Rd
M man/smooth_select.Rd
M man/time_frame_range.Rd
M man/timeframe_daterange.Rd
M man/timeframe_select.Rd
11 files changed, 46 insertions(+), 23 deletions(-)
Approvals:
OliverKeyes: Verified; Looks good to me, approved
diff --git a/NAMESPACE b/NAMESPACE
index c9095f0..361ba70 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand
+export(automata_select)
export(cbind_fill)
export(check_past_week)
export(check_yesterday)
diff --git a/R/manipulate.R b/R/manipulate.R
index 186f30a..dec529e 100644
--- a/R/manipulate.R
+++ b/R/manipulate.R
@@ -1,16 +1,11 @@
#'@title Safely retrieve the last N values from an object
-#'
#'@description using tail() to get the last sequential values in an object
relies
#'on that object being ordered, which it sometimes isn't due to backfilling.
\code{safe_tail}
#'retrieves the last N values in a "safe" way, taking the possibility of
unordered data into
#'account.
-#'
#'@param x an object to tail
-#'
#'@param n the number of values to take
-#'
#'@param silent whether to produce warnings and messages or not. TRUE by
default.
-#'
#'@export
safe_tail <- function(x, n, silent = TRUE) {
if (!is.vector(x) && !is.data.frame(x)) {
@@ -37,12 +32,9 @@
#'@title Sample Half an Object
#'@description easily sample the top or bottom half of an object.
-#'
#'@param x the object to sample from
-#'
#'@param top whether it should be the top (TRUE) or bottom (FALSE) half.
#'Set to TRUE by default.
-#'
#'@export
half <- function(x, top = TRUE){
if(top){
diff --git a/R/shiny.R b/R/shiny.R
index 1c6ae7b..3aefbb3 100644
--- a/R/shiny.R
+++ b/R/shiny.R
@@ -4,9 +4,17 @@
#'@family inputs
#'@export
smooth_select <- function(input_id, label = "Smoothing") {
- return(selectInput(inputId = input_id, label = label, selectize = TRUE,
+ return(shiny::selectInput(inputId = input_id, label = label, selectize =
TRUE,
selected = "global", choices = c("Use Global Setting" =
"global",
"No Smoothing" = "day",
"Weekly Median" = "week", "Monthly Median" = "month")))
+}
+#'@title Standardised Input Selector for Automata Filtering
+#'@param input_id ID
+#'@param label Label
+#'@family inputs
+#'@export
+automata_select <- function(input_id, label = "Include automata (e.g. web
crawlers)") {
+ return(shiny::checkboxInput(input_id, label = label, value = TRUE))
}
#'@title Standardized Drop-down Selector for Time Frame
#'@param input_id ID
@@ -16,10 +24,10 @@
#'@seealso timeframe_daterange "Shiny Dashboarding"
#'@export
timeframe_select <- function(input_id, label = "Time Frame") {
- return(selectInput(inputId = input_id, label = label, selectize = TRUE,
selected = "global",
- choices = c("Use Global Setting" = "global", "All
available data" = "all",
- "Last 7 days" = "week", "Last 30 days" =
"month",
- "Last 90 days" = "quarter", "Custom" =
"custom")))
+ return(shiny::selectInput(inputId = input_id, label = label, selectize =
TRUE, selected = "global",
+ choices = c("Use Global Setting" = "global", "All
available data" = "all",
+ "Last 7 days" = "week", "Last 30 days"
= "month",
+ "Last 90 days" = "quarter", "Custom" =
"custom")))
}
#'@title Standardized Date Range Selector for Time Frame
#'@param select_input_id The ID you used for the corresponding
@@ -30,9 +38,9 @@
#'@seealso timeframe_select
#'@export
timeframe_daterange <- function(select_input_id, label = "Custom Date Range") {
- return(conditionalPanel(paste0("input.", select_input_id," == 'custom'"),
- dateRangeInput(paste(select_input_id, "daterange",
sep = "_"), label = label,
- start = Sys.Date()-11, end =
Sys.Date()-1, min = "2015-04-14")))
+ return(shiny::conditionalPanel(paste0("input.", select_input_id," ==
'custom'"),
+ shiny::dateRangeInput(paste(select_input_id,
"daterange", sep = "_"), label = label,
+ start = Sys.Date()-11,
end = Sys.Date()-1, min = "2015-04-14")))
}
#'@title Get The Time Range
diff --git a/man/automata_select.Rd b/man/automata_select.Rd
new file mode 100644
index 0000000..52fae75
--- /dev/null
+++ b/man/automata_select.Rd
@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/shiny.R
+\name{automata_select}
+\alias{automata_select}
+\title{Standardised Input Selector for Automata Filtering}
+\usage{
+automata_select(input_id, label = "Include automata (e.g. web crawlers)")
+}
+\arguments{
+\item{input_id}{ID}
+
+\item{label}{Label}
+}
+\seealso{
+Other inputs: \code{\link{smooth_select}},
+ \code{\link{timeframe_daterange}},
+ \code{\link{timeframe_select}}
+}
+
diff --git a/man/check_notify.Rd b/man/check_notify.Rd
index 987528d..ca285dd 100644
--- a/man/check_notify.Rd
+++ b/man/check_notify.Rd
@@ -21,7 +21,7 @@
detected.
}
\seealso{
-Other Shiny Dashboarding: \code{\link{cond_color}},
+Other Shiny.Dashboarding: \code{\link{cond_color}},
\code{\link{cond_icon}}, \code{\link{time_frame_range}}
}
diff --git a/man/cond_color.Rd b/man/cond_color.Rd
index cb7f9c1..d0f1ba6 100644
--- a/man/cond_color.Rd
+++ b/man/cond_color.Rd
@@ -18,7 +18,7 @@
Uses green as the "true" colour by default, "red" as false, and
}
\seealso{
-Other Shiny Dashboarding: \code{\link{check_notify}},
+Other Shiny.Dashboarding: \code{\link{check_notify}},
\code{\link{cond_icon}}, \code{\link{time_frame_range}}
}
diff --git a/man/cond_icon.Rd b/man/cond_icon.Rd
index c81bf4e..0706d6c 100644
--- a/man/cond_icon.Rd
+++ b/man/cond_icon.Rd
@@ -17,7 +17,7 @@
change in condition.
}
\seealso{
-Other Shiny Dashboarding: \code{\link{check_notify}},
+Other Shiny.Dashboarding: \code{\link{check_notify}},
\code{\link{cond_color}}, \code{\link{time_frame_range}}
}
diff --git a/man/smooth_select.Rd b/man/smooth_select.Rd
index 03de68d..02a8ea1 100644
--- a/man/smooth_select.Rd
+++ b/man/smooth_select.Rd
@@ -12,7 +12,8 @@
\item{label}{Label}
}
\seealso{
-Other inputs: \code{\link{timeframe_daterange}},
+Other inputs: \code{\link{automata_select}},
+ \code{\link{timeframe_daterange}},
\code{\link{timeframe_select}}
}
diff --git a/man/time_frame_range.Rd b/man/time_frame_range.Rd
index 0e67def..8dc51ac 100644
--- a/man/time_frame_range.Rd
+++ b/man/time_frame_range.Rd
@@ -37,7 +37,7 @@
\seealso{
\code{\link{subset_by_date_range}}
-Other Shiny Dashboarding: \code{\link{check_notify}},
+Other Shiny.Dashboarding: \code{\link{check_notify}},
\code{\link{cond_color}}, \code{\link{cond_icon}}
}
diff --git a/man/timeframe_daterange.Rd b/man/timeframe_daterange.Rd
index 31314af..5b7864e 100644
--- a/man/timeframe_daterange.Rd
+++ b/man/timeframe_daterange.Rd
@@ -18,7 +18,8 @@
\seealso{
timeframe_select
-Other inputs: \code{\link{smooth_select}},
+Other inputs: \code{\link{automata_select}},
+ \code{\link{smooth_select}},
\code{\link{timeframe_select}}
}
diff --git a/man/timeframe_select.Rd b/man/timeframe_select.Rd
index ff7f240..1addfdc 100644
--- a/man/timeframe_select.Rd
+++ b/man/timeframe_select.Rd
@@ -17,7 +17,8 @@
\seealso{
timeframe_daterange "Shiny Dashboarding"
-Other inputs: \code{\link{smooth_select}},
+Other inputs: \code{\link{automata_select}},
+ \code{\link{smooth_select}},
\code{\link{timeframe_daterange}}
}
--
To view, visit https://gerrit.wikimedia.org/r/260760
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I605973e2e76a4cafcab175152c420d444ddabfd3
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/discovery/polloi
Gerrit-Branch: master
Gerrit-Owner: Bearloga <[email protected]>
Gerrit-Reviewer: OliverKeyes <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits