events2df: A funtion that takes a parsed xml doc, find observableDatum...

Description Usage Arguments Details Value

Description

A funtion that takes a parsed xml doc, find observableDatum nodes according to the xpath, and turn it into a dataframe It assumes the node is a '//observableData/observableDatum', with extended Info (i.e., "content").

Usage

1
events2df(xmldoc, xpath, filterOutEvents = NULL, dropEvents = NULL)

Arguments

xmldoc

The parsed xml output, e.g., doc <- xmlParse("SampleLog.xml")

xpath

The xpath expression that defines the observableEvents; can be 'xpath1|xpath2'

filterOutEvents

The optional filterOutEvents is a list of events (as.character) that should be taken out before calculating the duration of other events. Examples are the system events (e.g., eventType =="api.*")

dropEvents

The optional dropEvents is a list of event names that are used in calculating event durations, but are taken out at the output stage because they are not of interest.

Details

Turning the observableEvents into a dataframe is easy. The function does a number of things that facilitate further analysis. – It adds the test-taker-level info – It turns extendedInfo in the "content" subnode into a named list, and replaces the '$content' var – It corrects the "sceneId" for "nav.scene" events – It converts the timestamp into POSIXct and calculates various duration measures, where "dur" is the time in between each events (i.e., row), "durSinceTestStart" when 0 is the timestamp of the very first event, and "durSinceSceneStart" when 0 is for each "nav.scene". – It filters out unwanted events using the optional 'filterOutEvents' param; it also drops dropEvents at the end.

Value

A data frame, with one observableEvent (defined by the xpath) as a row


garyfeng/pdata documentation built on May 16, 2019, 5:42 p.m.