parse.smtrx: Parse timestamp data.

View source: R/parse.R

parse.smtrxR Documentation

Parse timestamp data.

Description

Converts string representation of timestamp value into date time object. Most exported sociometric measurements are timestamped. During the export (from Datalab) and import process (into R), the timestamp is stored as a string representation which needs to be converted into a date time object. The col parameter indicates the position of the column which holds the timestamp values, mostly the first column. This method is called by most parse functions to make sure the uniform naming and formatting of the timestamp column across all different sociometric data types. If the raw_df timestamp data is already a POSIXct object the data frame is returned directly.

Usage

## S3 method for class 'smtrx'
parse(raw_df, format = NULL, as_posixct = T, ts_col = 1, tz = NULL)

Arguments

raw_df

Data frame as result of read_* functions. One column holds a character representation of timestamp values.

format

Formatting string for timestamp. format=NULL dispatches probe_ts_format to assign a format automatically from a pre-established list (most common formats). format=1|2 is the index position to the vector of formats; format="%d/%m/%y" indicates specific format to be used in strptime.

  1. "%m/%d/%y %H:%M:%OS"

  2. "%Y-%m-%d %H:%M:%OS"

as_posixct

Logical. If resulting timestamp should be converted to POSIXct object.

ts_col

Index or name of colum that holds timestamp data.

tz

String. Specify timezone. Default tz=NULL will use Syst.timezone()

Value

Original data frame with timestamp column converted to datetime object. Data frame has class "smtrx".


jmueller17/sociometrics documentation built on March 20, 2024, 1:04 a.m.