Processing Data from Activity Logger App

If you use the Activity Logger in your research, please cite Kristoffer Geyer’s work with the reference:

Geyer. K. (2018a). Activity Logger (1.12). [Mobile application software]. Retrieved from: https://play.google.com/store/apps/details?id=sensor.location.android.activitylog

I collected data from  12 phones across 9+ days to pilot the app for my latest study (See Here!) . Participants were asked to download the app from the Google Play Store.

Data is stored on participants phones and then emailed to the researcher at the end of the study. The data comes out like this: Click here to view example data!

The next job is to convert this this data.txt file into a format whereby statistics can be conducted. This can be done in R and RStudio. The next part of this blog will demonstrate the processes I went through to clean and organise the data.

First of all I loaded in the data.text file:

 

Next, I converted the .txt data into a data frame that could be processed. Notably the markers : and – were used to segment the data. I also added a column whereby the unix timestamp was converted into a human readable format:

 

 

The next section calculates the duration of each use by comparing the time differences between adjacent ON and OFF timestamps. An extra column is created showing each events duration:

 

 

Next I wanted to create functions that read the duration data and outputted statistics for a pre-defined time range. Here I have written functions that calculate how long the screen was on in that particular time frame and in addition, the screen off duration, total number of uses, and the total amount of checks (uses that are less than 15 seconds in duration):

 

 

To use the above functions I needed to input a start and end timestamp. This was to tell R from what period of time I wanted to select data from. I aimed to create daily statistics of use. This meant the first timestamp would be the midnight where the day starts, and the last timestamp would be  the end of the day (following midnight). However to do this, I needed to calculate all the midnights in the study:

 

 

Now that I have a list of midnights, and when each day ends I can input these timestamps into the functions written. However, to save me from doing this several times for each day of the study, I have made functions which loop automatically until all days of the study have usage statistics. I then put all these statistics into a .csv which is then saved in my working directory. The functions I am calling here are TotalOnSecs, No.PhoneUses, and CheckFreq to generate daily usage statistics:

 

 

The resultant .csv looks like this:  DailyDataPhoneStatistics

Finally, I wanted to quickly plot the usage statistics across the days of the study:

 

 

Here are the graphs:

 

 

If you would like to replicate this analysis on your own data from the Activity Logger application, you can copy and paste the whole script here. It should work for any length of data:

 

Leave a Reply