read_logs: Read user's log files

Description Usage Arguments Details Value

Description

These functions help to read a user's session, events, or stream log files. read_logs() is a wrapper function that uses the default values of all other functions to read all log files into a single list. If this fails, the log files can be read separately using the other functions and by adjusting the variables appropriately.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
read_logs(user_dir)

read_session(user_dir, file_name = "session.tsv", col_names = c("var",
  "info"), tz = "Australia/Sydney")

read_events(user_dir, file_name = "events.tsv", col_names = c("time",
  "event", "detail"))

read_stream(user_dir, file_name, stream_dir = "streams/", is_numeric = TRUE,
  is_vec3 = FALSE)

read_all_streams(user_dir, pattern = "tsv$", stream_dir = "streams/",
  is_numeric = c("input_brake", "input_horizontal", "input_vertical"),
  is_vec3 = c("position", "rotation", "velocity"))

Arguments

user_dir

Character string defining the user's log-file directory

file_name

Character string of the file name. Must include extension such as .tsv

col_names

Vector of column names to be used.

tz

a character string that specifies which time zone to parse the date with. The string must be a time zone that is recognized by the user's OS.

stream_dir

Character string defining the directory in which stream log files exist.

is_numeric

Indicate whether a stream variable is numeric and, therefore, should be convereted to numeric. Can be a boolean value (TRUE/FALSE) or a character vector of variable names to convert if present.

is_vec3

Indicate whether a stream variable is a Vector3 value in Unity and, therefore, should be convereted to a vector of 3 values. Can be a boolean value (TRUE/FALSE) or a character vector of variable names to convert if present.

pattern

an optional regular expression. Only file names which match the regular expression will be returned.

Details

All files that can be read are assumed to be tab-separated values without variable headers. Uniquely, they are assumed to:

session

Appear in top-level of user's log file directory; contain variable names and values

events

Appear in top-level of user's log file directory; contain a timestamp and an event name (tab-separated details about the event can follow in some cases).

stream

Appear in streams/ directory of user's log file directory; contain a timestamp and a value.

Most functions are helper functions to read in a single file. read_all_streams, however, reads all the stream files in a directory and merges them into a single tibble. Also, read_logs will make use of all the functions to read all log files into a list.

Value

read_logs with return a list with a "user" S3 class, with three tibbles (session, events and streams). All others will return a single tibble.


drsimonj/adapter documentation built on May 15, 2019, 2:51 p.m.