Bearloga has uploaded a new change for review.
https://gerrit.wikimedia.org/r/260760
Change subject: Add spider selector
......................................................................
Add spider selector
Change-Id: I605973e2e76a4cafcab175152c420d444ddabfd3
---
D NAMESPACE
M R/manipulate.R
M R/shiny.R
M man/check_notify.Rd
M man/cond_color.Rd
M man/cond_icon.Rd
M man/smooth_select.Rd
A man/spider_select.Rd
M man/time_frame_range.Rd
M man/timeframe_daterange.Rd
M man/timeframe_select.Rd
11 files changed, 43 insertions(+), 60 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/polloi
refs/changes/60/260760/1
diff --git a/NAMESPACE b/NAMESPACE
deleted file mode 100644
index c9095f0..0000000
--- a/NAMESPACE
+++ /dev/null
@@ -1,39 +0,0 @@
-# Generated by roxygen2: do not edit by hand
-
-export(cbind_fill)
-export(check_past_week)
-export(check_yesterday)
-export(compress)
-export(cond_color)
-export(cond_icon)
-export(custom_axis_formatter)
-export(half)
-export(mad)
-export(make_dygraph)
-export(percent_change)
-export(read_dataset)
-export(safe_tail)
-export(smooth_select)
-export(smooth_switch)
-export(smoother)
-export(subset_by_date_range)
-export(time_frame_range)
-export(timeframe_daterange)
-export(timeframe_select)
-importFrom(RColorBrewer,brewer.pal)
-importFrom(dygraphs,dyCSS)
-importFrom(dygraphs,dyLegend)
-importFrom(dygraphs,dyOptions)
-importFrom(dygraphs,dygraph)
-importFrom(dygraphs,renderDygraph)
-importFrom(lubridate,month)
-importFrom(lubridate,week)
-importFrom(lubridate,year)
-importFrom(lubridate,ymd)
-importFrom(magrittr,"%>%")
-importFrom(plyr,ddply)
-importFrom(readr,read_delim)
-importFrom(shiny,icon)
-importFrom(shinydashboard,notificationItem)
-importFrom(xts,xts)
-importFrom(zoo,rollmean)
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..ad1fe49 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
+spider_select <- function(input_id, label = "Include spiders") {
+ 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/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..081a4e6 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{spider_select}},
+ \code{\link{timeframe_daterange}},
\code{\link{timeframe_select}}
}
diff --git a/man/spider_select.Rd b/man/spider_select.Rd
new file mode 100644
index 0000000..2417732
--- /dev/null
+++ b/man/spider_select.Rd
@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/shiny.R
+\name{spider_select}
+\alias{spider_select}
+\title{Standardised Input Selector for Automata Filtering}
+\usage{
+spider_select(input_id, label = "Include spiders")
+}
+\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/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..bcda9c0 100644
--- a/man/timeframe_daterange.Rd
+++ b/man/timeframe_daterange.Rd
@@ -19,6 +19,7 @@
timeframe_select
Other inputs: \code{\link{smooth_select}},
+ \code{\link{spider_select}},
\code{\link{timeframe_select}}
}
diff --git a/man/timeframe_select.Rd b/man/timeframe_select.Rd
index ff7f240..3826172 100644
--- a/man/timeframe_select.Rd
+++ b/man/timeframe_select.Rd
@@ -18,6 +18,7 @@
timeframe_daterange "Shiny Dashboarding"
Other inputs: \code{\link{smooth_select}},
+ \code{\link{spider_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: newchange
Gerrit-Change-Id: I605973e2e76a4cafcab175152c420d444ddabfd3
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/polloi
Gerrit-Branch: master
Gerrit-Owner: Bearloga <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits