Skip to contents

This function reads one more multiple CSV files containing wearable data exported from m-Path.

Usage

read_mpathwear(path, recursive = FALSE)

Arguments

path

A character string to the directory containing the data files or a single file path.

recursive

A logical value indicating whether data files should be searched in subdirectories.

Value

A tibble containing the following columns:

VariableExplanation
connectionIdThe participant ID in m-Path.
legacyCodeThe legacy invitation code format. Corresponds directly to code.
codeThe invitation code used in the study, if any.
aliasThe alias of the participant (can be changed by the participant at any point).
initialsThe initials of the participant based on the first seen alias.
accountCodeThe account code of the researcher.
startUTSThe start of the requested data period in Unix timestamp format.
stopUTSThe end of the requested data period in Unix timestamp format.
lastCreatedAtUnixThe last Unix timestamp at which the wearable data was updated.
dynamicDataThe intraday (i.e. momentary) wearable data.
dailyDataThe interday (i.e. daily) wearable data.

See the m-Path manual page on data exporting for more information on the columns connectionId through accountCode, as these are part of the default m-Path data output.

See also

clean_dynamic_data() and clean_daily_data() for unpacking the dynamic and daily data.

Examples

# Your path to the data, or in this case the package example data.
# Note that this can also be a folder containing several files.
path <- system.file("extdata", "example.csv", package = "mpathwear")

read_mpathwear(path)
#> # A tibble: 3 × 9
#>   connectionId legacyCode  code     alias initials accountCode lastCreatedAtUnix
#>   <chr>        <chr>       <chr>    <chr> <chr>    <chr>                   <dbl>
#> 1 123456       !1234@abc12 !abcd e… exam… exa      abc12           1764164955448
#> 2 123456       !1234@abc12 !abcd e… exam… exa      abc12           1764165350362
#> 3 123456       !1234@abc12 !abcd e… exam… exa      abc12           1764166043493
#> # ℹ 2 more variables: dynamicData <list>, dailyData <list>