apply: Apply a loaded nfer specification to a dataframe of events.

View source: R/apply.R

applyR Documentation

Apply a loaded nfer specification to a dataframe of events.

Description

This function obtains the interval abstractions generated by applying the nfer specification to the events.

Usage

apply(handle, events)

Arguments

handle

The loaded nfer specification (using nfer::load, or nfer::learn)

events

The dataframe of events to abstract using nfer.

Details

Event traces are passed as dataframes with at least two columns. The first two columns contain event names and timestamps, respectively. Names should be strings. Timestamps should be integers or strings, ideally, but may be numeric. Subsequent columns contain data, where the column name is the data key. The column value will be the data value for each event, where NA means no value is present.

Example dataframe events:

| name | timestamp | x |    y |
-------------------------------
| foo  | 123       | 2 | NA   |
| bar  | 987       | 3 | TRUE |

The result of the function is also a dataframe, but this contains intervals. The difference is that it has an extra timestamp column. Column two is now the start time of the interval, and column 3 is the end time. Name is still column one and columns 4+ are still data.

Dataframe interval output:

| name | start | end | z  |
---------------------------
| far  | 123   | 987 | NA |
| baf  | 654   | 987 | 3  |

Value

A dataframe containing intervals.

Examples

ops <- nfer::load(system.file("extdata", "ops.nfer", package = "nfer"))
events <- nfer::read(system.file("extdata", "ops.events", package = "nfer"))
intervals <- nfer::apply(ops, events)

nfer documentation built on April 12, 2023, 12:40 p.m.