exposure {mds} | R Documentation |
MD-PMS Exposure Data Frame
Description
Converts a data frame into a MD-PMS Exposure data frame.
Usage
exposure(
data_frame,
time,
device_hierarchy,
event_hierarchy = NULL,
key = NULL,
match_levels = NULL,
count = NULL
)
Arguments
data_frame |
The input data frame requiring components specified in the remaining arguments. |
time |
Character name of date variable in Example: |
device_hierarchy |
Vector of character variable names representing the
device hierarchy in Example: |
event_hierarchy |
Vector of character variable names representing the
event hierarchy in Example: Default: |
key |
Character name of (uniquely identifying) primary key variable in
Example: Default: |
match_levels |
Vector of character variable names in Example: Default: |
count |
Character name of exposure count variable in Example: Default: |
Value
A standardized MD-PMS data frame of class mds_e
.
Rows are deduplicated. Attributes are as follows:
- key
Original variable name for
key
- time
Original variable name for
time
- device_hierarchy
Vector of original variable names for
device_hierarchy
with converted variable names correspondingly named.- event_hierarchy
Vector of original variable names for
event_hierarchy
with converted variable names correspondingly named.- match_levels
Vector of variable names for grouping factors
- count
Original variable name for
count
Examples
# A barebones dataset
ex <- exposure(sales, "sales_month", "device_name")
# With more variables and variable types
ex <- exposure(
data_frame=sales,
time="sales_month",
device_hierarchy="device_name",
match_levels="region",
count="sales_volume")