Description Usage Arguments Details Value Functions Examples
A shiny module to slice tibble of time series(tsibble) by user's filter. conditions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | slice_tsbl_ui(id, debug = FALSE)
slice_tsbl_server(
id,
tsbl_vars,
slice_type = c("cross_section", "time_series"),
debug = FALSE
)
slice_tsbl_app(
use_online_data = FALSE,
slice_type = c("cross_section", "time_series"),
debug = on_debug()
)
|
id |
An ID string of module to connecting UI function and Server function. |
debug |
A logic to enable debug or not, default is on_debug() which returns DEBUG environment variable. |
tsbl_vars |
A tsibble of time series to be sliced. |
slice_type |
A character indicator about how to slice data, e.g., "cross_section", "time_series". Default is cross_section. |
use_online_data |
A logical to determine whether to use test data from database or not. Default FALSE means to use achieved data for tests. |
The module is an UI for user to choose some conditions for slice(filter) tibble of time series.
User will promote to use following filter conditions to filter:
Industry codes: one or many industry codes.
Stock codes: one or many stock codes.
Variable coes: one or many variables to focus.
Period: Period type of time series, such as "quarter", "month", "week", etc.
Date range:
Single Period: specify report date.
Multiple Periods: specify start/end date.
Industry average: options for computing industry average.
Average by: a variable used to compute industry average.
Average method: use mean or median to compute industry average.
UI function doesn't return value.
Server function return a list of tsibbles sliced by user's filter conditions, which contains following fields:
slice_vars : a tsibble of variables sliced by user.
slice_vars_average: a tsibble of average of variables sliced by user.
slice_tsbl_ui
: UI function of slicing tibble of time series.
slice_tsbl_server
: Server function of slicing tibble of time series.
slice_tsbl_app
: Testing App for slicing tibble of time series.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Not run:
# Set up control UI in app UI
ui <- fluidPage(
slice_tsbl_ui("slice_tsbl_module")
)
# Call control server in App server
server <- function(input, output, session) {
# Slice tsibble of variables by timeseries and show result in debug mode
slice_result <- slice_tsbl_server("slice_tsbl_module",
tsbl_vars = reactive(tsbl_vars),
slice_type = "time_series",
debug = TRUE
)
# A tsibble of variables sliced by user
slice_tsbl_vars <- slice_result$slice_vars
# A tsibble of industry average of variables sliced by user
slice_vars_average <- slice_result$slice_vars_average
}
# Run testing App for integration testing
slice_tsbl_app( use_online_data = FALSE,
slice_type = "time_series",
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.