Description Usage Arguments Value See Also Examples
View source: R/indicator-build.R
Use modifying function to modify indicator timeseries, e.g. add new attribute to existed indicator timeseries.
1 2 3 4 5 6 7 8 9 |
ts_indicator |
A dataframe of indicator timeseries to modify. |
modify_fun |
A function of modify indicator. |
... |
Params to modify_fun. |
replace_exist |
A logic flag to determine whether to replace existed attribute fields. Default FALSE means to not replace existed field. |
date_index_field |
Name of date index field of ts_indicator, default 'date'. |
key_fields |
A character vector of key fields, which identify unique observation in each date. Default NULL means to not divide data into groups. |
parallel |
A logic to determine whether to use parallel processing. Default TRUE means to use parallel processing. |
A dataframe of modified indicator timeseries if succeed, otherwise NULL.
Other indicator build functions:
compute_indicator()
,
create_indicator()
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 29 30 31 32 33 34 35 36 37 | ## Not run:
# modify ts_indicator with customized ind_attr_def_fun
# create attribute definition function of customized attribute
attr_fun <- function(date, stkcd, ...) {
"attr_value"
}
ind_attr_def_fun <- create_attribute_def_fun(
attr_name,
attr_fun = attr_fun
)
# modify existed ts_indicators
ts_modify_indicator <- modify_indicator(ts_modify_indicator,
modify_fun = ind_attr_def_fun,
date_index_field = "date",
key_fields = "stkcd",
parallel = FALSE
)
# modify ts_indicator with pre-defined ind_attr_def_fun
# create definition function of pre-defined attribute of indcd
new_attr_indcd <- ind_attr_def_indcd(stock_db)
# modify existed ts_indicators
ts_indicator <- modify_indicator(
ts_indicator = ts_indicator,
modify_fun = new_attr_indcd,
replace_exist = FALSE,
date_index_field = "date",
key_fields = "stkcd",
parallel = FALSE
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.