This function copies and existing function and creates a duplicate based on the definition.
cm_copy(
id,
name = NULL,
description = NULL,
polarity = NULL,
precision = NULL,
type = NULL,
create_cm = FALSE,
debug = FALSE,
rsid = NULL,
company_id = Sys.getenv("AW_COMPANY_ID")
)
The id of the old calculated metric
This is the name of the new calculated metric. If not provided, the prefix "Copy_" will be added to the existing name. (optional)
This is the description of the segment (optional)
Also known as 'Show Upward Trend As' in the UI. Options include 'positive' or 'negative'. Default is based on original calculated metric definition. This metric polarity setting shows whether Analytics should consider an upward trend in the metric as good (green) or bad (red). As a result, the report’s graph will show as green or red when it’s going up. Default is based on original calculated metric definition.
Shows how many decimal places will be shown in the report. The maximum number of decimal places you can specify is 10. Also known as 'Decimal Places' in the UI. Default is based on original calculated metric definition.
Choices include decimal (default), time, percent, and currency. Also known as 'Format' in the UI. Default is based on original calculated metric definition.
Used to determine if the segment should be created in the report suite or if the definition should be returned to be validated using cm_validate. Default is FALSE
This enables the api call information to show in the console for help with debugging issues. default is FALSE
Adobe report suite ID (RSID). If an environment variable called
AW_REPORTSUITE_ID
exists in .Renviron
or elsewhere and no rsid
argument
is provided, then the AW_REPORTSUITE_ID
value will be used. Use aw_get_reportsuites()
to get a list of available rsid
values.
Company ID. If an environment variable called AW_COMPANY_ID
exists in .Renviron
or elsewhere and no company_id
argument is provided,
then the AW_COMPANY_ID
value will be used. Use get_me()
to get a list of
available company_id
values.
If the "create_cm" argument is set to FALSE a list object definition will be returned. If the "create_cm" argument is set to TRUE and the calculated metric is valid it will return a data frame of the newly created calculated metric id along with some other basic meta data. If it returns an error then the error response will be returned to help understand what needs to be corrected.
See more information here