cm_copy: Copy a Calculated Metric

View source: R/cm_copy.R

cm_copyR Documentation

Copy a Calculated Metric

Description

This function copies and existing function and creates a duplicate based on the definition.

Usage

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")
)

Arguments

id

The id of the old calculated metric

name

This is the name of the new calculated metric. If not provided, the prefix "Copy_" will be added to the existing name. (optional)

description

This is the description of the segment (optional)

polarity

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.

precision

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.

type

Choices include decimal (default), time, percent, and currency. Also known as 'Format' in the UI. Default is based on original calculated metric definition.

create_cm

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

debug

This enables the api call information to show in the console for help with debugging issues. default is FALSE

rsid

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

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.

Details

See more information here

Value

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.


adobeanalyticsr documentation built on Nov. 9, 2023, 5:07 p.m.