mpathsenser 1.2.4
CRAN release: 2025-11-13
Major changes
-
link_db()is now defunct. Please uselink()instead. - Bump minimum R requirement to 4.2.0 as the native pipe
|>is used in this package. - Added
add_timezone_to_db()function to add the timezone “measurements” to each measurement of sensor data. This allows you to more easily take into account which timezone a participant was in instead of only relying on UTC. - Added
with_localtime()function to easily add the relevant timezone to a timestamp, even if multiple timezones are present in the data. Note that this does not work in-database.
Minor changes
-
import()now supports the new output format forconnectivitywhereconnectivity_statuscan be a list of statuses as well. -
mpathsenserno longer gives a warning for unimplemented ‘mpathinfo’ meta data. -
bin_data()gained a.nameargument to specify the name of the column containing the binned data. - The use of
progressr::progress()has been removed from the documentation is this function is now defunct.
Bugfixes
- Fixed a bug in
import()where files could not be read in correctly if they did not contain any measurement with asensorEndTime. - Fixed
unzip_data()not correctly detecting which files not to overwrite ifoverwrite = FALSEand the zip files have a non-standard name. -
import()now correctly readsstudy_idif it contains an underscore_.
mpathsenser 1.2.3
CRAN release: 2024-03-29
This is a hotfix release to fix a bug in import().
mpathsenser 1.2.2
CRAN release: 2024-02-23
Major changes
mpathsenser now supports the new data format as of m-Path Sense 4.2.6. This comes with a large number of changes. Most importantly, this means that import() had to be updated to handle the new data format. Both the old and new data format are now supported by this package. With the new data format there are some changes to the database.
First, some fields have been removed:
- The
x,y, andzfields fromAccelerometerhave been removed fromimport()and all subsequent functions. These fields were only used when m-Path Sense still collected continuous data, and for some time now only summary data is collected. No continuous data has ever been collected outside of pilot testing, and hence these fields have been removed. - The
x_mean,y_mean,z_mean,x_mean_sq,y_mean_sq,z_mean_sq, andnfields fromGyroscopehave been removed as m-Path Sense will currently collect continuous data. These fields were implemented in anticipation of this change but instead, for now, gyroscopic information has been removed from the app altogether. Thus, these fields are removed from simplicity and clarity. - The
timezonefield has been removed from all sensor tables. This field was once added in m-Path Sense but this never made it to the final version. It has been removed from the database and all subsequent functions.
Second, some fields have been added:
- The
Accelerometerhas gained many new data fields:-
end_timeis the time at which the sample of the data ended, wheretimedenotes the start time. -
n, the number of samples, was already present but has been moved in the ordering of the fields. -
x_mean,y_mean, andz_meanare the mean values of the accelerometer data. These were already present in the data and remain unchanged. -
x_median,y_median, andz_medianare the median values of the accelerometer data. -
x_std,y_std, andz_stdare the standard deviations of the accelerometer data. -
x_aad,y_aad, andz_aadare the average absolute deviations of the accelerometer data. -
x_min,y_min, andz_minare the minimum values of the accelerometer data. -
x_max,y_max, andz_maxare the maximum values of the accelerometer data. -
x_max_min_diff,y_max_min_diff, andz_max_min_diffare the differences between the maximum and minimum values of the accelerometer data. -
x_mad,y_mad, andz_madare the median absolute deviations of the accelerometer data. -
x_iqr,y_iqr, andz_iqrare the interquartile ranges of the accelerometer data. -
x_neg_n,y_neg_n, andz_neg_nare the number of negative values of the accelerometer data. -
x_pos_n,y_pos_n, andz_pos_nare the number of positive values of the accelerometer data. -
x_above_mean,y_above_mean, andz_above_meanare the number of values above the mean of the accelerometer data. -
x_energy,y_energy, andz_energyare similar tox_mean_sq,y_mean_sq, andz_mean_sq, being the average sum of squares. -
avg_res_accis the average resultant acceleration, being average of the square roots of the values in each of the three axis squared and added together. -
smais the signal magnitude area, being the sum of absolute values of the three axis averaged over a window.
-
- The
AppUsagetable has gained 2 new fields:-
end_timeis the time at which the sample of the data ended, wheretimedenotes the start time. Note that this timestamp may vary slightly from theendfield in the data. -
package_nameis the full application package name. -
last_foregroundis the time at which the application was last in the foreground. If the app had not yet been in the foreground, this isNA.
-
- The
Bluetoothtable has gained 2 new fields:-
start_scanis the time at which the scan started. -
end_scanis the time at which the scan ended.
-
- The
Devicetable has gained 2 new fields:-
operating_system_versionis the version of the operating system. -
sdkis the version of the Android SDK or the iOS kernel.
-
- A new sensor
Heartbeathas been added to the data. This table has the following fields:-
measurement_id,participant_id,date, andtimelike every other sensor. -
perioddenotes the time period over which the a heartbeat should be registered, in minutes. -
device_typedenotes the type of device of this heartbeat. -
device_role_nameis the role name of the device in the protocol.
-
- The
Lighttable has gained 1 new field:-
end_timeis the time at which the sample of the data ended, wheretimedenotes the start time.
-
-
Locationhas gained 3 new fields:-
vertical_accuracyis the estimated vertical accuracy of this location, in meters. -
heading_accuracyis the estimated bearing accuracy of this location, in degrees. Only available on Android. -
is_mockis a boolean indicating whether this location was mocked or not. AlwaysFALSEon iOS. Moreover, because SQLite does not support booleans, this is stored as an integer.
-
- The
Noisetable has gained 1 new field:-
end_timeis the time at which the sample of the data ended, wheretimedenotes the start time.
-
-
Timezonehas been added a separate sensor. This table has the following fields:-
measurement_id,participant_id,date, andtimelike every other sensor. -
timezoneis the time zone of the device at the time of the measurement.
-
Data collected with previous version of m-Path Sense (henceforth referred to as legacy data) can still be read by import() and subsequent functions, but all new fields will have missing values.
Minor changes
-
mpathsenser::sensorsnow holds 27 sensors, being updated withHeartbeatandTimezone - Added the correct citation for this package.
- Coverage plots with absolute numbers
coverage(relative = FALSE)now show correct colours. The colours are now based on the relative values within each sensor, such that the highest sample is fully red and zero being fully blue. -
vacuum_db()is a newly exported function within this package. Once called upon a database, it shrinks the database to its minimal size by cleaning up remnants fromimport(). - The
maggrittrpackage has been dropped as a dependency, favouringR’s native pipe|>over themaggrittrpipe%>%. - Added a vignette ‘Data overview’ to clarify which fields are available in the database and what they mean.
- Added a
formatargument togeocode_rev()to allow for different output formats from Nominatim’s API. -
geocode_rev()andapp_category()now returnNAif the client or API is offline, as per CRAN guidelines.
Bugfixes
- Fixed an issue in
fix_jsons()where files with illegal ASCII characters could be not fixed because the file was still locked from reading. - A new case has been added to
fix_jsons()where JSON files could incorrectly end with}},followed by a closing bracket]on a new line. This trailing comma is now removed byfix_jsons(). - If
recursive = TRUEinunzip_data()andto = NULL, the output path of the JSON files will be the local directories through which the recursive path is traversed rather than the main directory. - Replaced double quotation marks with single quotation marks in the description, per CRAN guidelines.
mpathsenser 1.1.3
CRAN release: 2023-02-07
This is a release with breaking changes due to removal of deprecated arguments. Please review carefully before updating.
This release also supports changes from the new release of m-Path Sense (01/02/2023). Most notably, the accelerometer and gyroscope are no longer samples of a continuous stream, but rather summaries of these streams. Old versions are still supported by all functions.
Major changes
- Thanks to a new version of m-Path Sense, accelerometer and gyroscope have gained extra columns:
-
x_mean: The average acceleration or gyroscopic value along thexaxis within a sample; -
y_mean: The average acceleration or gyroscopic value along theyaxis within a sample; -
z_mean: The average acceleration or gyroscopic value along thezaxis within a sample; -
x_mean_sq: The mean of the squaredxvalues within the sample; -
y_mean_sq: The mean of the squaredyvalues within the sample; -
z_mean_sq: The mean of the squaredzvalues within the sample; From these values, one could calculate theL1 normandL2 normlike before.
-
- Added a new value
timezoneto all sensor data. Confusingly, this is not the timezone of the data itself (as this is always in UTC), but rather the timezone the participant was in at the time of the measurement.
Deprecations
- Removed deprecated
parallelargument infix_jsons(),test_jsons(),unzip_data(), andimport(). - Removed deprecated
overwrite_dbanddbnamearguments fromimport(). - Removed deprecated
pathanddb_namearguments fromcopy_db().
Minor changes
- Provided support for dplyr 1.1.0.
-
link()no longer adds an extra row before (ifadd_before = TRUE) or after (ifadd_after = TRUE) if the first or last measurement equals the start or end time respectively. - Changed
link_db()lifecycle status to deprecated aslink_db()depends onlink(). Eventually,link()might see changes in its functionality that will causelink_db()to break, so it is better to deprecate it already to motivate users to stop using this function.
Bugfixes
- Fix cross-reference to undeclared package ‘future’ in documentation.
- Fixed bug #8 where
bin_data()incorrectly handled days occurring after DST change.
mpathsenser 1.1.2
CRAN release: 2022-12-12
Major changes
-
link()gained 3 new arguments:-
time: The name of the column containing the timestamps inx. -
end_time: Optionally, the name of the column containing the end time inx. -
y_time: The name of the column containing the timestamps iny. -
name: The name of the nestedydata, defaulting to"data".
Usingend_time, it is now possible to specify custom time intervals instead of only fixed intervals throughoffset_beforeoroffset_after. Note that these two functionality cannot be specified at the same time.
-
-
timeandy_timeinlink()must now be explicitly named, though for the time being default to ‘time’ with a warning. - Added
continueargument toadd_gaps()that controls whether the last measurement(s) should be continued after a gap. -
link_db()is now soft deprecated as it provides only marginal added functionality compared tolink(). -
decrypt_gps()now takes a vector of encrypted GPS coordinates instead of a whole data frame with fixed variables names (latitudeandlongitude). This allows more flexibility in its use. Also, parallelisation has been added similar to other functions in this package (i.e. by setting a future plan, e.g.future::plan("multisession")).
Deprecations
The following functions are now made defunctional and internal:
These functions delivered incorrect output and only allowed summaries by a fixed time frame, e.g. by hour or day. These functions will be reimplemented (some with a different name) in mpathsenser 2.0.0.
Minor changes
- When
add_beforeoradd_afterisTRUEinlink(), no extra row is added if there already is a row with a timestamp exactly equal to the start of the interval (foradd_before = TRUE) or to the end of the interval (add_after = TRUE). -
moving_average()now allows a lazy tibble to allow further computations in-database after having calledmoving_average(). -
identify_gaps()is now slightly more efficient. -
get_data()is now case insensitive. In a future update, all sensor names throughout all functions will be made case insensitive. - When using
add_before = TRUE,link()no longer adds an extra measurement if the first measurement in the interval equals the start time of the interval exactly. -
get_data()now allows multipleparticipant_ids to be used. -
external_timehas been added as an argument tolink_db(), to be able to specify the time column inexternal_datain accordance with the change inlink()above.
Bugfixes
-
link()now correctly handles natural joins (whenby = NULL) and cross joins (whenby = character()). - The column
original_timewas not added for any other nested data row except the first one, ifadd_beforeoradd_afterwas true. -
link()no longer suffers fromfuture’s max object restriction (500MB by default). - When
xandyuse different time zones inlink()andadd_before = TRUE,link()now correctly leaves all time zones equal to the input. -
link()incorrectly assigned the time zone ofxto the nested data ofy, ifadd_beforeoradd_afterwas true. This is now changed to the time zone ofy, to ensure consistency. Note that if the time zones ofxandyare different, matching will be correct but the nested data may seem off as it will keepy’s input time zone.
mpathsenser 1.1.1
CRAN release: 2022-11-07
Major changes
-
identify_gaps()now allows multiple sensors to be used. This is particularly useful when there are no sensors with high frequency sampling (like accelerometer and gyroscope) or to ensure there can be no measurements within the gaps from any sensor. - Changed the arguments names of
copy_db()from_dbandto_dbtosource_dbandtarget_dbrespectively. - Set
activity_duration(),screen_duration(),n_screen_on(),n_screen_unlocks(), andstep_count()to internal until it is clear how these functions should behave and, more importantly, what their output should be. - Reworked
moving_average()to work correctly on multiple participants.
Deprecations
- Deprecated functionality for on-the-fly database creation in several functions. This disentangles the functionalities of
create_db()and the other functions, where the latter implicitly depended on the former. The following arguments are thereby rendered disabled: - Deprecated the
parallelargument in several functions. If you wish to process in parallel, you must now specify this beforehand using a future plan, e.g.future::plan("multisession"). As a consequence, the packagefutureis no longer a dependency (butfurrris). - Deprecated the
plotargument incoverage(). To plot a coverage chart, you can now use the defaultplot()function with the output fromcoverage().
Minor changes
- All functions gained basic argument checking, ensuring that input arguments have at least the proper type.
- The package now provides more nicely formatted errors, warnings, and messages through
rlang::abort,rlang::warn, andrlang::inform. - Partially rewrote
import()to be more manageable in code. As a consequence, the dependency onrjsonanddbxcan be dropped in favour ofjsonliteand native SQL. - Added
lifecycleas a dependency for deprecating arguments. - Added a warning section in
identify_gaps()and friends to inform the user of a possible inconsistency when identifying gaps. - Switched
identify_gaps()from using the lag of each measurements towards using the lead. This makes no difference in the output but is a little easier to read.
Bug fixes
- Fixed a note when first running
link()orlink_gaps()in a session, stating that using external vectorsdplyr::select()is ambiguous. -
bin_data()now correctly includes measurements in bins that do not have a stop time. This was in particular a problem with the last measurement of a series. - Fixed a non-working example in
bin_data(). - Fixed a bug in
add_gaps()where multiple gaps in succession (i.e. without other data in between) were incorrectly handled. - Fixed
app_category()not being able to find the exact app name in the search results, thereby defaulting to thenth result (default 1).
mpathsenser 1.1.0
CRAN release: 2022-10-06
Major changes
- Added several functions:
-
link_gaps(): For linking gap data to other data, i.e. how many gaps occur within an interval. -
add_gaps(): To interleave gaps with other data. -
bin_data(): To subdivide data into bins, e.g. all measurements within an hour or day.
-
- Added lifecycle badge to signal the state of functions.
-
link()has been revised and expanded:- Replaced
offsetwithoffset_beforeandoffset_after, allowing both to be specified at the same time (#3). - Added new
add_beforeandadd_afterargument to allow the last row before the measurement and first row after the measurement respectively to be added to the data. - Added a new
splitargument, allowing computation to be split among many parts thereby lowering computational burden.
- Replaced
-
app_category()is now case insensitive and gained the new argumentexactto be able to match the package name exactly based on a partial match. - Added a (start of a) vignette to further highlight the package use.
Minor changes
- Changed
get_activity()toactivity_duration(). - Changed
link2()tolink_db().
Bug fixes
- Fixed issue where
link()runs out of memory when there are too many matches (#2).link()is now much more memory efficient and slightly faster. - Fixed issue in
get_data()which allowed multiple sensors to be requested from one function call, sometimes leading to crashes (#4). - Fixed issue in
link()where columnoriginal_timeis missing if no records before or after the interval are found (#6). - Fixed a bug in
import()where sensor data not present in first file of the batch are dropped for the other files well. - Fixed
app_category()to work with the updated Google Play website.
