MovingAverage
Description
td_moving_average_sqle()
function computes average values in a series, using the specified moving average type.
Usage
td_moving_average_sqle (
data = NULL,
target.columns = NULL,
alpha = 0.1,
start.rows = 2,
window.size = 10,
include.first = FALSE,
mavgtype = "C",
...
)
Arguments
data |
Required Argument. |
target.columns |
Optional Argument. |
alpha |
Optional Argument. |
start.rows |
Optional Argument. |
window.size |
Optional Argument. |
include.first |
Optional Argument. |
mavgtype |
Optional Argument. |
... |
Specifies the generic keyword arguments SQLE functions accept. volatile: Function allows the user to partition, hash, order or local order the input data. These generic arguments are available for each argument that accepts tbl_teradata as input and can be accessed as:
Note: |
Value
Function returns an object of class "td_moving_average_sqle"
which is a named list containing object of class "tbl_teradata".
Named list member(s) can be referenced directly with the "$" operator
using the name(s):result
Examples
# Get the current context/connection.
con <- td_get_context()$connection
# Load the example data.
loadExampleData("exponentialmovavg_example", "ibm_stock")
# Create tbl_teradata object.
ibm_stock <- tbl(con, "ibm_stock")
# Check the list of available analytic functions.
display_analytic_functions()
# Example 1: Compute the average values in a series, using the 'C' moving average type.
obj <- td_moving_average_sqle(data=ibm_stock,
data.partition.column='stockprice',
data.order.column='stockprice',
include.first=FALSE,
alpha=0.1,
start.rows=2,
window.size=10,
mavgtype='C')
# Print the result.
print(obj$result)