# NOT RUN {
# Use sample data
df = sample_raw_accel_data
# segment data into 1 minute segments
output = segment_data(df, "1 min")
# check the 3rd segment, each segment would have 1 minute data
summary(output[output['SEGMENT'] == 3,])
# segment data into 15 second segments
output = segment_data(df, "15 sec")
# check the 1st segment, each segment would have 15 second data
summary(output[output['SEGMENT'] == 1,])
# segment data into 1 hour segments
output = segment_data(df, "1 hour")
# because the input data has only 15 minute data
# there will be only 1 segment in the output
unique(output['SEGMENT'])
summary(output)
# use manually set start time
output = segment_data(df, "15 sec", st='2016-01-15 10:59:50.000')
# check the 1st segment, because the start time is 10 seconds before the
# start time of the actual data, the first segment will only include 5 second
# data.
summary(output[output['SEGMENT'] == 1,])
# }
Run the code above in your browser using DataLab